[Spice-devel] [PATCH spice-server 6/8] stream-device: Do not read past data message
Christophe Fergeau
cfergeau at redhat.com
Fri Feb 23 16:07:44 UTC 2018
On Sun, Feb 18, 2018 at 06:58:12PM +0000, Frediano Ziglio wrote:
> If data message is followed by another message was theoretically
> possible that device looses the sync with the guest.
"If the data message is followed by another message, it's theoritically
possible that the device loses the sync with the guest."
> The actual Qemu and agent implementation avoids it but better
> to avoid it.
"The actual Qemu and streaming agent implementations avoid it, but
better to make sure this can't happen in the server code too."
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
Christophe
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> 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 170c8637..ddac0ca9 100644
> --- a/server/stream-device.c
> +++ b/server/stream-device.c
> @@ -281,7 +281,7 @@ handle_msg_data(StreamDevice *dev, SpiceCharDeviceInstance *sin)
>
> while (1) {
> uint8_t buf[16 * 1024];
> - n = sif->read(sin, buf, sizeof(buf));
> + n = sif->read(sin, buf, MIN(sizeof(buf), dev->hdr.size));
> if (n <= 0) {
> break;
> }
> --
> 2.14.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180223/9123eb62/attachment-0001.sig>
More information about the Spice-devel
mailing list