from_backend() should always be called with len > 0. Only rlogin
[u/mdw/putty] / plink.c
diff --git a/plink.c b/plink.c
index b7a2fd4..b2c07ac 100644 (file)
--- a/plink.c
+++ b/plink.c
@@ -8,6 +8,7 @@
 #include <windows.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <assert.h>
 #include <stdarg.h>
 
 #define PUTTY_DO_GLOBALS              /* actually _define_ globals */
@@ -147,6 +148,8 @@ int from_backend(int is_stderr, char *data, int len)
     HANDLE h = (is_stderr ? errhandle : outhandle);
     int osize, esize;
 
+    assert(len > 0);
+
     if (is_stderr) {
        bufchain_add(&stderr_data, data, len);
        try_output(1);