Avoid the ldisc passing zero-length strings to back->send(). VMS
[u/mdw/putty] / ldisc.c
diff --git a/ldisc.c b/ldisc.c
index dda7cc3..59bddb2 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 };