VirtualBox

Changeset 86535 in vbox for trunk


Ignore:
Timestamp:
Oct 12, 2020 8:42:38 AM (4 years ago)
Author:
vboxsync
Message:

pdmnetinline.h: Some adjustments to bugref:9764

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmnetinline.h

    r85149 r86535  
    543543            if (iSeg == 0)
    544544            {
    545                 Assert(pGso->offHdr2 + sizeof(uint16_t) <= cbFrame);
    546                 /* uh_ulen cannot exceed cbFrame - pGso->offHdr2 (offset of UDP header) */
    547                 if ((unsigned)(pGso->offHdr2 + RT_BE2H_U16(((PCRTNETUDP)&pbFrame[pGso->offHdr2])->uh_ulen)) > cbFrame)
     545                /* uh_ulen shall not exceed cbFrame - pGso->offHdr2 (offset of UDP header) */
     546                PRTNETUDP pUdpHdr = (PRTNETUDP)&pbFrame[pGso->offHdr2];
     547                Assert(pGso->offHdr2 + RT_UOFFSET_AFTER(RTNETUDP, uh_ulen) <= cbFrame);
     548                if ((unsigned)(pGso->offHdr2 + RT_BE2H_U16(pUdpHdr->uh_ulen)) > cbFrame)
    548549                {
    549                     if (cbFrame > UINT16_MAX)
    550                         ((PRTNETUDP)&pbFrame[pGso->offHdr2])->uh_ulen = 0xFFFF;
     550                    size_t cbUdp = cbFrame - pGso->offHdr2;
     551                    if (cbUdp >= UINT16_MAX)
     552                        pUdpHdr->uh_ulen = UINT16_MAX;
    551553                    else
    552                         ((PRTNETUDP)&pbFrame[pGso->offHdr2])->uh_ulen = RT_H2BE_U16((uint16_t)(cbFrame - pGso->offHdr2));
     554                        pUdpHdr->uh_ulen = RT_H2BE_U16((uint16_t)cbUdp);
    553555                }
    554                 Assert((unsigned)(pGso->offHdr2 + ((PCRTNETUDP)&pbFrame[pGso->offHdr2])->uh_ulen) <= cbFrame);
    555556                pdmNetGsoUpdateUdpHdrUfo(RTNetIPv4PseudoChecksum((PRTNETIPV4)&pbFrame[pGso->offHdr1]),
    556557                                         pbSegHdrs, pbFrame, pGso->offHdr2);
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