VirtualBox

Changeset 33816 in vbox for trunk/src/VBox/Storage/DMG.cpp


Ignore:
Timestamp:
Nov 5, 2010 10:11:03 PM (14 years ago)
Author:
vboxsync
Message:

DMG: Check for the magic values before converting the footer structure to host endian byte order to avoid assertions if an image with another format is checked

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/DMG.cpp

    r33773 r33816  
    751751
    752752        default:
    753 //            AssertMsgFailed(("%x\n", u32Kind));
     753            AssertMsgFailed(("%x\n", u32Kind));
    754754            break;
    755755    }
     
    16341634    if (RT_SUCCESS(rc))
    16351635    {
    1636         dmgUdifFtrFile2HostEndian(&Ftr);
    1637 
    16381636        /*
    16391637         * Do we recognize this stuff? Does it look valid?
    16401638         */
    1641         if (    Ftr.u32Magic    == DMGUDIF_MAGIC
    1642             &&  Ftr.u32Version  == DMGUDIF_VER_CURRENT
    1643             &&  Ftr.cbFooter    == sizeof(Ftr))
     1639        if (    Ftr.u32Magic    == RT_H2BE_U32(DMGUDIF_MAGIC)
     1640            &&  Ftr.u32Version  == RT_H2BE_U32(DMGUDIF_VER_CURRENT)
     1641            &&  Ftr.cbFooter    == RT_H2BE_U32(sizeof(Ftr)))
    16441642        {
     1643            dmgUdifFtrFile2HostEndian(&Ftr);
    16451644            if (dmgUdifFtrIsValid(&Ftr, offFtr))
    16461645            {
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