]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Ignore the zero byte at the start of the rlogin main protocol
authorSimon Tatham <anakin@pobox.com>
Thu, 1 Feb 2001 14:09:00 +0000 (14:09 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 1 Feb 2001 14:09:00 +0000 (14:09 +0000)
[originally from svn r920]

rlogin.c

index 9ce73095751d4fe1389f22f410425b1aece05f7d..e20b9e68c3d9285ef6a8cef056c05466a0c2900e 100644 (file)
--- a/rlogin.c
+++ b/rlogin.c
@@ -49,8 +49,22 @@ static int rlogin_receive (Socket skt, int urgent, char *data, int len) {
          * on 0x10 and 0x20 respectively. I'm not convinced it's
          * worth it...
          */
+    } else {
+        /*
+         * Main rlogin protocol. This is really simple: the first
+         * byte is expected to be NULL and is ignored, and the rest
+         * is printed.
+         */
+        static int firstbyte = 1;
+        if (firstbyte) {
+            if (data[0] == '\0') {
+                data++;
+                len--;
+            }
+            firstbyte = 0;
+        }
+        c_write(data, len);
     }
-    c_write(data, len);
     return 1;
 }