Blame SOURCES/kvm-ui-correctly-advance-output-buffer-when-writing-SASL.patch

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