]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Avoid the ldisc passing zero-length strings to back->send(). VMS 0.49
authorSimon Tatham <anakin@pobox.com>
Mon, 26 Jun 2000 12:55:47 +0000 (12:55 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 26 Jun 2000 12:55:47 +0000 (12:55 +0000)
sshd has interesting behaviour on receiving a zero-length SSH data
packet.

[originally from svn r508]

ldisc.c

diff --git a/ldisc.c b/ldisc.c
index dda7cc36e4d3b20861239e22ab2d33a37f4edca2..59bddb220737c7f9904591df6834a8a63ab2dc5d 100644 (file)
--- a/ldisc.c
+++ b/ldisc.c
@@ -123,7 +123,8 @@ static void term_send(char *buf, int len) {
            }
            break;
          case CTRL('M'):              /* send with newline */
-           back->send(term_buf, term_buflen);
+           if (term_buflen > 0)
+                back->send(term_buf, term_buflen);
            if (cfg.protocol == PROT_RAW)
                back->send("\r\n", 2);
            else
@@ -153,7 +154,8 @@ static void simple_send(char *buf, int len) {
            term_buflen--;
        }
     }
-    back->send(buf, len);
+    if (len > 0)
+        back->send(buf, len);
 }
 
 Ldisc ldisc_term = { term_send };