mirror of https://github.com/wolfSSL/wolfssh.git
Bugfix: erroring out on copying empty file; don't read if file size is 0.
parent
17008c635e
commit
6c6b405f68
|
@ -2454,11 +2454,13 @@ int wsScpSendCallback(WOLFSSH* ssh, int state, const char* peerRequest,
|
||||||
ret = ExtractFileName(peerRequest, fileName, fileNameSz);
|
ret = ExtractFileName(peerRequest, fileName, fileNameSz);
|
||||||
|
|
||||||
if (ret == WS_SUCCESS && sendCtx != NULL && sendCtx->fp != NULL) {
|
if (ret == WS_SUCCESS && sendCtx != NULL && sendCtx->fp != NULL) {
|
||||||
ret = (word32)WFREAD(buf, 1, bufSz, sendCtx->fp);
|
/* If it is an empty file, do not read. */
|
||||||
if (ret == 0) { /* handle unexpected case */
|
if (*totalFileSz != 0) {
|
||||||
ret = WS_EOF;
|
ret = (word32)WFREAD(buf, 1, bufSz, sendCtx->fp);
|
||||||
|
if (ret == 0) { /* handle unexpected case */
|
||||||
|
ret = WS_EOF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ret = WS_SCP_ABORT;
|
ret = WS_SCP_ABORT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue