VirtualBox

Changeset 3254 in vbox


Ignore:
Timestamp:
Jun 24, 2007 3:08:14 AM (17 years ago)
Author:
vboxsync
Message:

Fixed overflow detection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/time.cpp

    r2981 r3254  
    421421RTDECL(char *) RTTimeToString(PCRTTIME pTime, char *psz, size_t cb)
    422422{
    423     if (RTStrPrintf(psz, cb, "%RI32-%02u-%02uT%02u:%02u:%02u.%09RU32Z",
    424                     pTime->i32Year, pTime->u8Month, pTime->u8MonthDay,
    425                     pTime->u8Hour, pTime->u8Minute, pTime->u8Second, pTime->u32Nanosecond)
    426         <= cb)
     423    size_t cch = RTStrPrintf(psz, cb, "%RI32-%02u-%02uT%02u:%02u:%02u.%09RU32Z",
     424                             pTime->i32Year, pTime->u8Month, pTime->u8MonthDay,
     425                             pTime->u8Hour, pTime->u8Minute, pTime->u8Second, pTime->u32Nanosecond);
     426    if (    cch <= 1
     427        ||  psz[cch - 1] != 'Z')
    427428        return NULL;
    428429    return psz;
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