Re: [PATCH spice-server] StreamDevice: Fix incomplete header reads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> 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@xxxxxxxxxx>

Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

> ---
>  server/stream-device.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/server/stream-device.c b/server/stream-device.c
> index f87538d49..fc5b50659 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;
>          }

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]