ui: correctly advance output buffer when writing SASL data
commit627ebec208a8809818589e17f4fce55a59420ad2
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 1 Feb 2018 15:58:41 +0000 (1 15:58 +0000)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 2 Feb 2018 06:48:18 +0000 (2 07:48 +0100)
tree5c87fd531a23ff06de2fd9dcc46f9cc49318d620
parent13e1d0e71e78a925848258391a6e616b6b5ae219
ui: correctly advance output buffer when writing SASL data

In this previous commit:

  commit 8f61f1c5a6bc06438a1172efa80bc7606594fa07
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Mon Dec 18 19:12:20 2017 +0000

    ui: track how much decoded data we consumed when doing SASL encoding

I attempted to fix a flaw with tracking how much data had actually been
processed when encoding with SASL. With that flaw, the VNC server could
mistakenly discard queued data that had not been sent.

The fix was not quite right though, because it merely decremented the
vs->output.offset value. This is effectively discarding data from the
end of the pending output buffer. We actually need to discard data from
the start of the pending output buffer. We also want to free memory that
is no longer required. The correct way to handle this is to use the
buffer_advance() helper method instead of directly manipulating the
offset value.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 20180201155841.27509-1-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/vnc-auth-sasl.c