From nobody Thu Oct 27 14:49:27 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MypVH3jVdz4gDCM; Thu, 27 Oct 2022 14:49:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MypVH2vjGz3YDr; Thu, 27 Oct 2022 14:49:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666882167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F2WYlTob8eURGCuuTTG5rbdgTDzcwbmAOstnVh9Y1IA=; b=pYoOKUQrV7prq7Xj541/H9AMSEaKUboRjdPSQsEEB5zMNUtb6r+HIL8Lje5YqOxnlu2gSg GpbgC9F1QNA2DZ+7C19qJFjcIqyfOdhu5yPqJeQjEhlW5MDksY2GefAZo3tYGyPoPgNjl2 Oad6kHtJIGgqmXIMc/tlJLFIcIxl/0+4in1LMUNH1kUmzksY6N8NfWr8WbMGAe5o+wP+0u 6y+J7HHTYVsry/94pwtyJhea4pT7Y/hbfsF7/JEJkjiC3nHjheGOAO50XkKe9zeUmOKkx3 eY0yICd5U9xZrbKTZd5G/10Q8uYqW7u4d9HwTy+MIooj2BZpatKxz+K/MSJrSA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MypVH1xTSz11SQ; Thu, 27 Oct 2022 14:49:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29REnR49049083; Thu, 27 Oct 2022 14:49:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29REnRQP049082; Thu, 27 Oct 2022 14:49:27 GMT (envelope-from git) Date: Thu, 27 Oct 2022 14:49:27 GMT Message-Id: <202210271449.29REnRQP049082@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 04336c056248 - main - bhyve: Make sure that the VNC version is initialized List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 04336c0562488080300e68157ada5bc8eae71e54 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666882167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=F2WYlTob8eURGCuuTTG5rbdgTDzcwbmAOstnVh9Y1IA=; b=BZOjkfHxi0lAnN0kITrcNvt0E8xrZaNXXAcAaOmAXTFWgIzQxrV5Z1RsF4Nx0m2aWJQILc eYvbGRCPB9xMFAFEdEDnMl3wyBQL5Eri6l/VFGBrzLe3jeeaVPEu8QL+PHSHilZSRcEVJ+ wm7g6WzZRX8FDdsIA0x+YllvhUKUZSYBRoK7ya9EBs1WRmLJVzuQGYcVJfLv2njj+wcJQe ieP7MnX2sWGMLTetSeYvZO8AQ6w0sTbMUFIvoOKHfcZVVVSWt4ddvLvYblMy7Bybe2dvYQ HeBlxNt4fuh+EbUaWZ9Ji1UDcb8y9w21CrbnLTGI4WXn7KDz8Tks1zY6BVI1og== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666882167; a=rsa-sha256; cv=none; b=BhPiQM6bv6eYFAlPRoot/CcUCaRN0Ynw584B/F+mWZcWYnYoaHnGChN+WI+5Gpq2WGeB2L +rU5rNdGAfiUTbgY3DMfFFW26Hu9lpPLyFLTsCijMuUpJQwaH6JxSvEMZZEu3c61tMytfY p8L9eP9oPv1eKO6rQ76LW4/Lm1u7TIaLhYz9l0WKOVed+/HNHBMV9u6VyBtVQMI7j97n19 i0dHkQ15JBm6KmqO3h7Or94birwlKEmzHKYATV9kMD5GZ/dELXLxBLl70WJ1FwRXQnieNV sXhAWOG6pqjr1tNliwNvvCn4ugE0aRw8rW8Y6tO+Cuzv0hImaEEJ0V1ZPpXHfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=04336c0562488080300e68157ada5bc8eae71e54 commit 04336c0562488080300e68157ada5bc8eae71e54 Author: Mark Johnston AuthorDate: 2022-10-27 14:46:36 +0000 Commit: Mark Johnston CommitDate: 2022-10-27 14:48:55 +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. MFC after: 1 week Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D37117 --- 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 7f7a3514051e..2640a67902e1 100644 --- a/usr.sbin/bhyve/rfb.c +++ b/usr.sbin/bhyve/rfb.c @@ -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;