VirtualBox

Changeset 87234 in vbox for trunk/src


Ignore:
Timestamp:
Jan 13, 2021 12:33:59 PM (4 years ago)
Author:
vboxsync
Message:

DevVirtualKD: Limit the reply size as indicated by the request header field. Untested.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Misc/DevVirtualKD.cpp

    r87169 r87234  
    143143                 * Write the reply to guest memory (overwriting the request):
    144144                 */
    145                 /** @todo r=bird: RequestHeader.cbReplyMax is not taken into account here! */
     145                cbReply = RT_MIN(cbReply + 2, sRequestHeader.cbReplyMax);
    146146                VKDREPLYHDR ReplyHeader;
    147                 ReplyHeader.cbData = cbReply + 2;
     147                ReplyHeader.cbData = cbReply; /* The '1' and ' ' bytes count towards reply size. */
    148148                ReplyHeader.chOne = '1';
    149149                ReplyHeader.chSpace = ' ';
    150                 rc = PDMDevHlpPhysWrite(pDevIns, GCPhys, &ReplyHeader, sizeof(ReplyHeader));
    151                 if (cbReply && RT_SUCCESS(rc))
    152                     rc = PDMDevHlpPhysWrite(pDevIns, GCPhys + sizeof(ReplyHeader), pbReply, cbReply);
     150                rc = PDMDevHlpPhysWrite(pDevIns, GCPhys, &ReplyHeader, sizeof(ReplyHeader.cbData) + RT_MIN(cbReply, 2));
     151                if (cbReply > 2 && RT_SUCCESS(rc))
     152                    rc = PDMDevHlpPhysWrite(pDevIns, GCPhys + sizeof(ReplyHeader), pbReply, cbReply - 2);
    153153            }
    154154        }
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