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

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