Date: Thu, 27 Feb 2020 16:51:41 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358394 - head/usr.sbin/bhyve Message-ID: <202002271651.01RGpf4x038509@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Thu Feb 27 16:51:41 2020 New Revision: 358394 URL: https://svnweb.freebsd.org/changeset/base/358394 Log: 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. Submitted by: Ka Ho Ng <khng300_gmail.com> Reviewed by: grehan MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D23591 Modified: head/usr.sbin/bhyve/rfb.c Modified: head/usr.sbin/bhyve/rfb.c ============================================================================== --- head/usr.sbin/bhyve/rfb.c Thu Feb 27 15:34:30 2020 (r358393) +++ head/usr.sbin/bhyve/rfb.c Thu Feb 27 16:51:41 2020 (r358394) @@ -76,6 +76,7 @@ static int rfb_debug = 0; #define DPRINTF(params) if (rfb_debug) PRINTLN params #define WPRINTF(params) PRINTLN params +#define VERSION_LENGTH 12 #define AUTH_LENGTH 16 #define PASSWD_LENGTH 8 @@ -769,7 +770,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?202002271651.01RGpf4x038509>