]> git.ipfire.org Git - thirdparty/qemu.git/commit
ui/vnc: Fix problem with sending too many bytes as server name
authorThomas Huth <thuth@redhat.com>
Mon, 21 Nov 2016 17:25:15 +0000 (18:25 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 16 Mar 2017 17:10:39 +0000 (12:10 -0500)
commit8a6562592f74e8aafbc9f09392f1209bdfddc05e
tree130838e501cf951a667539e90b2175e059b64a8f
parent9f6cb916f2f72175bb8c7757662d9f50616fc4c0
ui/vnc: Fix problem with sending too many bytes as server name

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.

Buglink: https://bugs.launchpad.net/qemu/+bug/1637447
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1479749115-21932-1-git-send-email-thuth@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 97efe4f961dcf5a0126baa75e8a6bff66d33186f)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
ui/vnc.c