aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-05-12 17:07:28 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2020-05-12 17:07:28 +0000
commitfce5b0310c937af30789e7847cce0f9b995211fc (patch)
tree9af9de2ab385503caa191cd04d27e640bee91c36
parentbf458f467688fe255a11f0de2e1c83c8f51e3b34 (diff)
downloadsrc-fce5b0310c937af30789e7847cce0f9b995211fc.tar.gz
src-fce5b0310c937af30789e7847cce0f9b995211fc.zip
MF11 360965:
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. Approved by: re (gjb)
Notes
Notes: svn path=/releng/11.4/; revision=360981
-rw-r--r--usr.sbin/bhyve/rfb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.sbin/bhyve/rfb.c b/usr.sbin/bhyve/rfb.c
index 80405ee89491..2c5c2579746f 100644
--- a/usr.sbin/bhyve/rfb.c
+++ b/usr.sbin/bhyve/rfb.c
@@ -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;