VirtualBox

Changeset 27735 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Mar 26, 2010 12:56:00 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
59365
Message:

VMDK: Don't try to read more bytes from the descriptor than the filesize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp

    r27623 r27735  
    30933093         * alocate more than 128K, because that's no valid descriptor file
    30943094         * and will result in the correct "truncated read" error handling. */
    3095         uint64_t cbSize;
    3096         rc = vmdkFileGetSize(pFile, &cbSize);
     3095        uint64_t cbFileSize;
     3096        rc = vmdkFileGetSize(pFile, &cbFileSize);
    30973097        if (RT_FAILURE(rc))
    30983098            goto out;
     3099
     3100        uint64_t cbSize = cbFileSize;
    30993101        if (cbSize % VMDK_SECTOR2BYTE(10))
    31003102            cbSize += VMDK_SECTOR2BYTE(20) - cbSize % VMDK_SECTOR2BYTE(10);
     
    31123114        size_t cbRead;
    31133115        rc = vmdkFileReadAt(pImage->pFile, 0, pImage->pDescData,
    3114                             pImage->cbDescAlloc, &cbRead);
     3116                            RT_MIN(pImage->cbDescAlloc, cbFileSize),
     3117                            &cbRead);
    31153118        if (RT_FAILURE(rc))
    31163119        {
Note: See TracChangeset for help on using the changeset viewer.

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