From 49cd0545340f1920d0768d64940d494b30d1cf48 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Tue, 11 Sep 2018 16:37:22 -0600 Subject: [PATCH] exit "put" loop if at end of file --- src/wolfsftp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wolfsftp.c b/src/wolfsftp.c index 574e9ba7..63e5b932 100644 --- a/src/wolfsftp.c +++ b/src/wolfsftp.c @@ -4247,6 +4247,9 @@ int wolfSSH_SFTP_Put(WOLFSSH* ssh, char* from, char* to, byte resume, ret = WS_SUCCESS; do { rSz = (int)WFREAD(r, 1, WOLFSSH_MAX_SFTP_RW, fl); + if (rSz <= 0 ) { + break; /* either at end of file or error */ + } sz = wolfSSH_SFTP_SendWritePacket(ssh, handle, handleSz, pOfst, r, rSz); if (sz > 0) {