git: faa530a15f73 - stable/13 - bhyve: Make sure that the VNC version is initialized
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 03 Nov 2022 12:53:27 UTC
The branch stable/13 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=faa530a15f73cfc1c7ca9f977b3fdfc06ebee7f5
commit faa530a15f73cfc1c7ca9f977b3fdfc06ebee7f5
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-10-27 14:46:36 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-11-03 12:51:20 +0000
bhyve: Make sure that the VNC version is initialized
clang warned that "client_ver" can be left uninitialized. This change
causes the new connection to be dropped if a version string is not
presented.
Reviewed by: jhb
(cherry picked from commit 04336c0562488080300e68157ada5bc8eae71e54)
---
usr.sbin/bhyve/rfb.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/usr.sbin/bhyve/rfb.c b/usr.sbin/bhyve/rfb.c
index 4a550bca975b..2a7493f8fd6a 100644
--- a/usr.sbin/bhyve/rfb.c
+++ b/usr.sbin/bhyve/rfb.c
@@ -819,9 +819,12 @@ rfb_handle(struct rfb_softc *rc, int cfd)
/* 1b. Read client version */
len = stream_read(cfd, buf, VERSION_LENGTH);
- if (len == VERSION_LENGTH && !strncmp(vbuf, buf, VERSION_LENGTH - 2)) {
- client_ver = buf[VERSION_LENGTH - 2];
+ if (len != VERSION_LENGTH ||
+ strncmp(vbuf, buf, VERSION_LENGTH - 2) != 0) {
+ goto done;
}
+
+ client_ver = buf[VERSION_LENGTH - 2];
if (client_ver != CVERS_3_8 && client_ver != CVERS_3_7) {
/* only recognize 3.3, 3.7 & 3.8. Others dflt to 3.3 */
client_ver = CVERS_3_3;