[Spice-commits] server/stream-device.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Oct 31 09:21:31 UTC 2017


 server/stream-device.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1980dd5dd18d2e38342b31b423cecb09c4f3a977
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Tue Oct 31 09:47:46 2017 +0100

    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 at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/stream-device.c b/server/stream-device.c
index f87538d4..fc5b5065 100644
--- a/server/stream-device.c
+++ b/server/stream-device.c
@@ -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;
         }


More information about the Spice-commits mailing list