The use of read() to read RFB client version before this change is inappropriate as it is not guaranteed to have exactly 12 bytes in the receive buffer.
#define VERSION_LENGTH 12
at the top, use that instead of 12, and this will be good to go.
Updating D23591: bhyve: use stream_read() to read 12 bytes of RFB client version
Changed as suggested.