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.

MFC after:	1 week
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D37117
This commit is contained in:
Mark Johnston 2022-10-27 10:46:36 -04:00
parent e7c13cf438
commit 04336c0562

View File

@ -885,9 +885,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;