From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 3/3] ui: correctly advance output buffer when writing SASL data
Date: Fri, 2 Feb 2018 08:17:51 +0100 [thread overview]
Message-ID: <20180202071751.16316-4-kraxel@redhat.com> (raw)
In-Reply-To: <20180202071751.16316-1-kraxel@redhat.com>
From: Daniel P. Berrangé <berrange@redhat.com>
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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
index 74a5f513f2..fbccca8c8a 100644
--- a/ui/vnc-auth-sasl.c
+++ b/ui/vnc-auth-sasl.c
@@ -84,7 +84,7 @@ size_t vnc_client_write_sasl(VncState *vs)
} else {
vs->force_update_offset -= vs->sasl.encodedRawLength;
}
- vs->output.offset -= vs->sasl.encodedRawLength;
+ buffer_advance(&vs->output, vs->sasl.encodedRawLength);
vs->sasl.encoded = NULL;
vs->sasl.encodedOffset = vs->sasl.encodedLength = 0;
}
--
2.9.3
next prev parent reply other threads:[~2018-02-02 15:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 7:17 [Qemu-devel] [PULL 0/3] Ui 20180202 patches Gerd Hoffmann
2018-02-02 7:17 ` [Qemu-devel] [PULL 1/3] ui: fix mixup between qnum and qcode in SDL1 key handling Gerd Hoffmann
2018-02-02 7:17 ` [Qemu-devel] [PULL 2/3] ui: convert VNC server to QIONetListener Gerd Hoffmann
2018-02-02 7:17 ` Gerd Hoffmann [this message]
2018-02-02 17:49 ` [Qemu-devel] [PULL 0/3] Ui 20180202 patches Eric Blake
2018-02-02 18:29 ` Daniel P. Berrangé
2018-02-05 9:31 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180202071751.16316-4-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=berrange@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).