thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 1bf158dc510fc63f11725f2350369d06a3fff929 Mon Sep 17 00:00:00 2001
9ae3a8
From: "Daniel P. Berrange" <berrange@redhat.com>
9ae3a8
Date: Thu, 8 Feb 2018 17:50:40 +0100
9ae3a8
Subject: [PATCH 26/27] ui: correctly advance output buffer when writing SASL
9ae3a8
 data
9ae3a8
MIME-Version: 1.0
9ae3a8
Content-Type: text/plain; charset=UTF-8
9ae3a8
Content-Transfer-Encoding: 8bit
9ae3a8
9ae3a8
RH-Author: Daniel P. Berrange <berrange@redhat.com>
9ae3a8
Message-id: <20180208175041.5634-27-berrange@redhat.com>
9ae3a8
Patchwork-id: 78955
9ae3a8
O-Subject: [RHEL-7.5 qemu-kvm PATCH v1 26/27] ui: correctly advance output buffer when writing SASL data
9ae3a8
Bugzilla: 1527405
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
In this previous commit:
9ae3a8
9ae3a8
  commit 8f61f1c5a6bc06438a1172efa80bc7606594fa07
9ae3a8
  Author: Daniel P. Berrange <berrange@redhat.com>
9ae3a8
  Date:   Mon Dec 18 19:12:20 2017 +0000
9ae3a8
9ae3a8
    ui: track how much decoded data we consumed when doing SASL encoding
9ae3a8
9ae3a8
I attempted to fix a flaw with tracking how much data had actually been
9ae3a8
processed when encoding with SASL. With that flaw, the VNC server could
9ae3a8
mistakenly discard queued data that had not been sent.
9ae3a8
9ae3a8
The fix was not quite right though, because it merely decremented the
9ae3a8
vs->output.offset value. This is effectively discarding data from the
9ae3a8
end of the pending output buffer. We actually need to discard data from
9ae3a8
the start of the pending output buffer. We also want to free memory that
9ae3a8
is no longer required. The correct way to handle this is to use the
9ae3a8
buffer_advance() helper method instead of directly manipulating the
9ae3a8
offset value.
9ae3a8
9ae3a8
Reported-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
9ae3a8
Reviewed-by: Eric Blake <eblake@redhat.com>
9ae3a8
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Message-id: 20180201155841.27509-1-berrange@redhat.com
9ae3a8
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
(cherry picked from commit 627ebec208a8809818589e17f4fce55a59420ad2)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 ui/vnc-auth-sasl.c | 2 +-
9ae3a8
 1 file changed, 1 insertion(+), 1 deletion(-)
9ae3a8
9ae3a8
diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
9ae3a8
index 8188081..c39f588 100644
9ae3a8
--- a/ui/vnc-auth-sasl.c
9ae3a8
+++ b/ui/vnc-auth-sasl.c
9ae3a8
@@ -81,7 +81,7 @@ long vnc_client_write_sasl(VncState *vs)
9ae3a8
         } else {
9ae3a8
             vs->force_update_offset -= vs->sasl.encodedRawLength;
9ae3a8
         }
9ae3a8
-        vs->output.offset -= vs->sasl.encodedRawLength;
9ae3a8
+        buffer_advance(&vs->output, vs->sasl.encodedRawLength);
9ae3a8
         vs->sasl.encoded = NULL;
9ae3a8
         vs->sasl.encodedOffset = vs->sasl.encodedLength = 0;
9ae3a8
     }
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8