Date: Tue, 12 May 2020 16:05:21 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r360965 - in stable: 11/usr.sbin/bhyve 12/usr.sbin/bhyve Message-ID: <202005121605.04CG5Ll6033121@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Tue May 12 16:05:21 2020 New Revision: 360965 URL: https://svnweb.freebsd.org/changeset/base/360965 Log: MFC 358394: Use stream_read() to read all 12 bytes of the RFB client version. read() can return a short read, whereas stream_read() waits until the full version string is read. Modified: stable/11/usr.sbin/bhyve/rfb.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/usr.sbin/bhyve/rfb.c Directory Properties: stable/12/ (props changed) Modified: stable/11/usr.sbin/bhyve/rfb.c ============================================================================== --- stable/11/usr.sbin/bhyve/rfb.c Tue May 12 15:22:40 2020 (r360964) +++ stable/11/usr.sbin/bhyve/rfb.c Tue May 12 16:05:21 2020 (r360965) @@ -72,6 +72,7 @@ static int rfb_debug = 0; #define DPRINTF(params) if (rfb_debug) printf params #define WPRINTF(params) printf params +#define VERSION_LENGTH 12 #define AUTH_LENGTH 16 #define PASSWD_LENGTH 8 @@ -765,7 +766,7 @@ rfb_handle(struct rfb_softc *rc, int cfd) stream_write(cfd, vbuf, strlen(vbuf)); /* 1b. Read client version */ - len = read(cfd, buf, sizeof(buf)); + len = stream_read(cfd, buf, VERSION_LENGTH); /* 2a. Send security type */ buf[0] = 1;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005121605.04CG5Ll6033121>