mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-07 11:55:10 +00:00
StreamDevice: Fix incomplete header reads
The code for reading a StreamDevice message from the streaming agent has code to handle a situation where you only read a part of the header. If we've read only a part of the header, we will try to read the remaining n bytes of the header within a loop until the full header is read. However, when we try to read the last n bytes, we store it at beginning of the header struct, which will overwrite the first part of the header. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
3165247886
commit
1980dd5dd1
@ -81,7 +81,7 @@ stream_device_read_msg_from_dev(RedCharDevice *self, SpiceCharDeviceInstance *si
|
||||
|
||||
/* read header */
|
||||
while (dev->hdr_pos < sizeof(dev->hdr)) {
|
||||
n = sif->read(sin, (uint8_t *) &dev->hdr, sizeof(dev->hdr) - dev->hdr_pos);
|
||||
n = sif->read(sin, (uint8_t *) &dev->hdr + dev->hdr_pos, sizeof(dev->hdr) - dev->hdr_pos);
|
||||
if (n <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user