VirtualBox

Changeset 104337 in vbox for trunk/src


Ignore:
Timestamp:
Apr 17, 2024 11:48:57 AM (13 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
162819
Message:

VBoxNetFlt: Fixed regression from r162583 where the buffer was overlapping the buffer segment descriptor. bugref:10585

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.cpp

    r104159 r104337  
    11351135DECLHIDDEN(NDIS_STATUS) vboxNetFltWinAllocSG(UINT cbPacket, PINTNETSG *ppSG)
    11361136{
    1137     NDIS_STATUS Status;
    1138     PINTNETSG pSG;
    1139 
    11401137    /* allocation:
    11411138     * 1. SG_PACKET - with one aSegs pointing to
    11421139     * 2. buffer of cbPacket containing the entire packet */
    11431140    AssertCompileSizeAlignment(INTNETSG, sizeof(PVOID));
    1144     Status = vboxNetFltWinMemAlloc((PVOID*)&pSG, cbPacket + RT_UOFFSETOF_DYN(INTNETSG, aSegs[1]));
     1141    PINTNETSG   pSG    = NULL;
     1142    UINT const  cbSg   = RT_UOFFSETOF_DYN(INTNETSG, aSegs[1]);
     1143    NDIS_STATUS Status = vboxNetFltWinMemAlloc((PVOID *)&pSG, cbSg + cbPacket);
    11451144    if (Status == NDIS_STATUS_SUCCESS)
    11461145    {
    1147         IntNetSgInitTemp(pSG, pSG + 1, cbPacket);
     1146        IntNetSgInitTemp(pSG, (uint8_t *)pSG + cbSg, cbPacket);
    11481147        LogFlow(("pSG created (%p)\n", pSG));
    11491148        *ppSG = pSG;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette