VirtualBox

Changeset 100518 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 11, 2023 2:56:03 PM (17 months ago)
Author:
vboxsync
Message:

VUSB: Additional paranoia to clear USB buffers used by the guest (see bugref:10438).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/VUSBUrb.cpp

    r99739 r100518  
    678678    }
    679679
     680    /* Paranoia: Clear data memory that was previously used
     681     * by the guest. See @bugref{10438}.
     682     */
     683    PVUSBSETUP pOldSetup = pExtra->pMsg;
     684    uint32_t   cbClean = sizeof(VUSBSETUP) + pOldSetup->wLength;
     685    cbClean = RT_MIN(cbClean, pExtra->cbMax);
     686    memset(pExtra->Urb.abData, 0, cbClean);
     687
    680688    /*
    681689     * Check if we've got an cancelled message URB. Allocate a new one in that case.
     
    705713    {
    706714        uint32_t cbReq = RT_ALIGN_32(cbBuf + pSetupIn->wLength, 64);
    707         PVUSBCTRLEXTRA pNew = (PVUSBCTRLEXTRA)RTMemRealloc(pExtra, RT_UOFFSETOF_DYN(VUSBCTRLEXTRA, Urb.abData[cbReq]));
     715        PVUSBCTRLEXTRA pNew = (PVUSBCTRLEXTRA)RTMemReallocZ(pExtra,
     716                                                            RT_UOFFSETOF_DYN(VUSBCTRLEXTRA, Urb.abData[pExtra->cbMax]),
     717                                                            RT_UOFFSETOF_DYN(VUSBCTRLEXTRA, Urb.abData[cbReq]));
    708718        if (!pNew)
    709719        {
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