VirtualBox

Changeset 33484 in vbox for trunk


Ignore:
Timestamp:
Oct 27, 2010 8:44:01 AM (14 years ago)
Author:
vboxsync
Message:

Runtime: force zero terminated strings on file read

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/misc/tar.cpp

    r33464 r33484  
    206206    rc = RTStrToUInt32Full(pRecord->h.chksum, 8, &sum);
    207207    if (RT_SUCCESS(rc) && sum == check)
    208         return VINF_SUCCESS;
    209     return VERR_TAR_CHKSUM_MISMATCH;
     208    {
     209        /* Make sure the strings are zero terminated. */
     210        pRecord->h.name[sizeof(pRecord->h.name) - 1]         = 0;
     211        pRecord->h.linkname[sizeof(pRecord->h.linkname) - 1] = 0;
     212        pRecord->h.magic[sizeof(pRecord->h.magic) - 1]       = 0;
     213        pRecord->h.uname[sizeof(pRecord->h.uname) - 1]       = 0;
     214        pRecord->h.gname[sizeof(pRecord->h.gname) - 1]       = 0;
     215    }
     216    else
     217        rc = VERR_TAR_CHKSUM_MISMATCH;
     218
     219    return rc;
    210220}
    211221
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