VirtualBox

Changeset 101400 in vbox


Ignore:
Timestamp:
Oct 10, 2023 8:39:16 AM (16 months ago)
Author:
vboxsync
Message:

Devices/DevVirtioNet.cpp: Improve checks, bugref:10521

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevVirtioNet.cpp

    r100883 r101400  
    22952295            Log7Func(("[%s] Guest provided %d unicast MAC Table entries\n", pThis->szInst, cMacs));
    22962296
     2297            AssertMsgReturn(cMacs <= RT_ELEMENTS(pThis->aMacUnicastFilter),
     2298                            ("Guest provided Unicast MAC filter table exceeds hardcoded table size"), VIRTIONET_ERROR);
     2299
    22972300            if (cMacs)
    22982301            {
    22992302                uint32_t cbMacs = cMacs * sizeof(RTMAC);
    2300 
    2301                 AssertMsgReturn(cbMacs <= sizeof(pThis->aMacUnicastFilter)  / sizeof(RTMAC),
    2302                                 ("Guest provided Unicast MAC filter table exceeds hardcoded table size"), VIRTIONET_ERROR);
    23032303
    23042304                AssertMsgReturn(cbRemaining >= cbMacs,
     
    23222322            Log10Func(("[%s] Guest provided %d multicast MAC Table entries\n", pThis->szInst, cMacs));
    23232323
     2324            AssertMsgReturn(cMacs <= RT_ELEMENTS(pThis->aMacMulticastFilter),
     2325                            ("Guest provided Unicast MAC filter table exceeds hardcoded table size"), VIRTIONET_ERROR);
     2326
    23242327            if (cMacs)
    23252328            {
    23262329                uint32_t cbMacs = cMacs * sizeof(RTMAC);
    2327 
    2328                 AssertMsgReturn(cbMacs <= sizeof(pThis->aMacMulticastFilter)  / sizeof(RTMAC),
    2329                                 ("Guest provided Unicast MAC filter table exceeds hardcoded table size"), VIRTIONET_ERROR);
    23302330
    23312331                AssertMsgReturn(cbRemaining >= cbMacs,
     
    23752375            size_t cbRemaining = pVirtqBuf->cbPhysSend;
    23762376
    2377             AssertMsgReturn(cbRemaining > sizeof(cVirtqPairs),
     2377            AssertMsgReturn(cbRemaining >= sizeof(cVirtqPairs),
    23782378                ("DESC chain too small for VIRTIONET_CTRL_MQ cmd processing"), VIRTIONET_ERROR);
    23792379
     
    23812381            virtioCoreR3VirtqBufDrain(&pThis->Virtio, pVirtqBuf, &cVirtqPairs, sizeof(cVirtqPairs));
    23822382
    2383             AssertMsgReturn(cVirtqPairs > VIRTIONET_MAX_QPAIRS,
     2383            AssertMsgReturn(cVirtqPairs <= VIRTIONET_MAX_QPAIRS,
    23842384                ("[%s] Guest CTRL MQ virtq pair count out of range [%d])\n", pThis->szInst, cVirtqPairs), VIRTIONET_ERROR);
    23852385
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