[gtk-vnc] Fix off by 1 in initial protocol greeting



commit bc9e2b19167686dd381a0508af1a5113675d08a2
Author: Daniel P. Berrange <dan berrange com>
Date:   Thu Jun 17 20:18:33 2010 +0100

    Fix off by 1 in initial protocol greeting
    
    The client -> server greeting must be 12 bytes long, ending in a
    newline character. An off-by-1 in snprintf resulted in the 12th
    byte being a NULL instead. This caused wireshark to not detect
    the stream as VNC

 src/vncconnection.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index 3b54726..40ec86b 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -4266,7 +4266,7 @@ static gboolean vnc_connection_initialize(VncConnection *conn)
 		priv->minor = 8;
 	}
 
-	snprintf(version, 12, "RFB %03d.%03d\n", priv->major, priv->minor);
+	snprintf(version, 13, "RFB %03d.%03d\n", priv->major, priv->minor);
 	vnc_connection_write(conn, version, 12);
 	vnc_connection_flush(conn);
 	VNC_DEBUG("Using version: %d.%d", priv->major, priv->minor);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]