VirtualBox

Changeset 87119 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Dec 24, 2020 10:13:26 AM (4 years ago)
Author:
vboxsync
Message:

UsbMsd: Reject more invalid CBWs (see bugref:9862).

File:
1 edited

Legend:

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

    r82968 r87119  
    887887{
    888888    /* Copy the CBW */
    889     size_t cbCopy = RT_UOFFSETOF_DYN(USBCBW, CBWCB[pCbw->bCBWCBLength]);
     889    uint8_t bCBWLen = RT_MIN(pCbw->bCBWCBLength, sizeof(pCbw->CBWCB));
     890    size_t cbCopy = RT_UOFFSETOF_DYN(USBCBW, CBWCB[bCBWLen]);
    890891    memcpy(&pReq->Cbw, pCbw, cbCopy);
    891892    memset((uint8_t *)&pReq->Cbw + cbCopy, 0, sizeof(pReq->Cbw) - cbCopy);
     
    16221623                return usbMsdCompleteStall(pThis, NULL, pUrb, "Bad CBW");
    16231624            }
    1624             if (pCbw->bCBWCBLength == 0)
     1625            if ((pCbw->bCBWCBLength == 0) || (pCbw->bCBWCBLength > sizeof(pCbw->CBWCB)))
    16251626            {
    16261627                Log(("usbMsd: CBW: Bad bCBWCBLength value: %#x\n", pCbw->bCBWCBLength));
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