VirtualBox

Ignore:
Timestamp:
Apr 28, 2020 2:28:24 PM (5 years ago)
Author:
vboxsync
Message:

IPRT/strformatnum.cpp: Fixed check. bugref:9726

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/string/strformatnum.cpp

    r82968 r84050  
    8080        char szTmp[64];
    8181        cchRet = RTStrFormatNumber(szTmp, u16Value, uiBase, cchWidth, cchPrecision, fFlags);
    82         if ((size_t)cchRet <= cbBuf)
     82        if ((size_t)cchRet < cbBuf)
    8383            memcpy(pszBuf, szTmp, cchRet + 1);
    8484        else
     
    109109        char szTmp[64];
    110110        cchRet = RTStrFormatNumber(szTmp, u32Value, uiBase, cchWidth, cchPrecision, fFlags);
    111         if ((size_t)cchRet <= cbBuf)
     111        if ((size_t)cchRet < cbBuf)
    112112            memcpy(pszBuf, szTmp, cchRet + 1);
    113113        else
     
    138138        char szTmp[64];
    139139        cchRet = RTStrFormatNumber(szTmp, u64Value, uiBase, cchWidth, cchPrecision, fFlags);
    140         if ((size_t)cchRet <= cbBuf)
     140        if ((size_t)cchRet < cbBuf)
    141141            memcpy(pszBuf, szTmp, cchRet + 1);
    142142        else
     
    324324     */
    325325    ssize_t cchRet = pszTmp - &szTmp[0];
    326     if ((size_t)cchRet <= cbBuf)
     326    if ((size_t)cchRet < cbBuf)
    327327        memcpy(pszBuf, szTmp, cchRet + 1);
    328328    else
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette