]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - pscp.c
scp_recv_filedata: handle EOF more sensibly.
[PuTTY.git] / pscp.c
diff --git a/pscp.c b/pscp.c
index 150b5492b8948b3a90b0a17895970f58ab081df2..f7e09db959ccd1d60bdd4163f70b156aa0b265ce 100644 (file)
--- a/pscp.c
+++ b/pscp.c
@@ -1560,6 +1560,13 @@ int scp_recv_filedata(char *data, int len)
        }
 
        if (xfer_download_data(scp_sftp_xfer, &vbuf, &actuallen)) {
+            if (actuallen <= 0) {
+                tell_user(stderr, "pscp: %s while reading",
+                          actuallen < 0 ? "error" : "end of file");
+                errs++;
+                sfree(vbuf);
+                return -1;
+            }
            /*
             * This assertion relies on the fact that the natural
             * block size used in the xfer manager is at most that