Author: jhb
Date: Tue May 12 17:07:28 2020
New Revision: 360981
URL: https://svnweb.freebsd.org/changeset/base/360981

Log:
  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)

Modified:
  releng/11.4/usr.sbin/bhyve/rfb.c
Directory Properties:
  releng/11.4/   (props changed)

Modified: releng/11.4/usr.sbin/bhyve/rfb.c
==============================================================================
--- releng/11.4/usr.sbin/bhyve/rfb.c    Tue May 12 17:05:55 2020        
(r360980)
+++ releng/11.4/usr.sbin/bhyve/rfb.c    Tue May 12 17:07:28 2020        
(r360981)
@@ -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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to