From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c8skR-0000Cf-U0 for qemu-devel@nongnu.org; Mon, 21 Nov 2016 12:51:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c8skN-0000dx-2X for qemu-devel@nongnu.org; Mon, 21 Nov 2016 12:51:19 -0500 Message-ID: <1479750670.9742.47.camel@redhat.com> From: Gerd Hoffmann Date: Mon, 21 Nov 2016 18:51:10 +0100 In-Reply-To: <1479749115-21932-1-git-send-email-thuth@redhat.com> References: <1479749115-21932-1-git-send-email-thuth@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] ui/vnc: Fix problem with sending too many bytes as server name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org On Mo, 2016-11-21 at 18:25 +0100, Thomas Huth wrote: > If the buffer is not big enough, snprintf() does not return the number > of bytes that have been written to the buffer, but the number of bytes > that would be needed for writing the whole string. By using this value > for the following vnc_write() calls, we send some junk at the end of > the name in case the qemu_name is longer than 1017 bytes, which could > confuse the VNC clients. Fix this by adding an additional size check > here. Use g_strdup_printf instead? cheers, Gerd