From nobody Tue Feb 10 14:49:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1517589931479421.02163920959435; Fri, 2 Feb 2018 08:45:31 -0800 (PST) Received: from localhost ([::1]:39463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eheSt-0005ff-B1 for importer@patchew.org; Fri, 02 Feb 2018 11:45:27 -0500 Received: from eggs.gnu.org ([208.118.235.92]:60475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehdOC-0004ty-7z for qemu-devel@nongnu.org; Fri, 02 Feb 2018 10:37:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehdN8-00070u-2R for qemu-devel@nongnu.org; Fri, 02 Feb 2018 10:36:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4174) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ehdN7-0006yk-0C for qemu-devel@nongnu.org; Fri, 02 Feb 2018 10:35:25 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 33AC54F1B2 for ; Fri, 2 Feb 2018 07:17:54 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-227.ams2.redhat.com [10.36.116.227]) by smtp.corp.redhat.com (Postfix) with ESMTP id D92E778E80; Fri, 2 Feb 2018 07:17:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 26F9641A89; Fri, 2 Feb 2018 08:17:51 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 2 Feb 2018 08:17:51 +0100 Message-Id: <20180202071751.16316-4-kraxel@redhat.com> In-Reply-To: <20180202071751.16316-1-kraxel@redhat.com> References: <20180202071751.16316-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 02 Feb 2018 07:17:54 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/3] ui: correctly advance output buffer when writing SASL data X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Daniel P. Berrang=C3=A9 In this previous commit: commit 8f61f1c5a6bc06438a1172efa80bc7606594fa07 Author: Daniel P. Berrange 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 Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake Reviewed-by: Laszlo Ersek Message-id: 20180201155841.27509-1-berrange@redhat.com Signed-off-by: Gerd Hoffmann --- 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 -=3D vs->sasl.encodedRawLength; } - vs->output.offset -=3D vs->sasl.encodedRawLength; + buffer_advance(&vs->output, vs->sasl.encodedRawLength); vs->sasl.encoded =3D NULL; vs->sasl.encodedOffset =3D vs->sasl.encodedLength =3D 0; } --=20 2.9.3