mirror of https://github.com/wolfSSL/wolfssh.git
wolfsftp: check the resume seek in wolfSSH_SFTP_Put
A failed WFSEEK() left the local file at offset 0 while the remote write continued from the resume offset, silently corrupting the upload. Fail out through the local close instead, the file is open at that point. Issue: CID-572932pull/1140/head
parent
5f99058cbe
commit
1e4773e49b
|
|
@ -10053,7 +10053,15 @@ int wolfSSH_SFTP_Put(WOLFSSH* ssh, char* from, char* to, byte resume,
|
|||
#if SIZEOF_OFF_T == 8
|
||||
offset = (((word64)state->pOfst[1]) << 32) | offset;
|
||||
#endif
|
||||
WFSEEK(ssh->fs, state->fl, offset, 0);
|
||||
if (WFSEEK(ssh->fs, state->fl, offset, 0) != 0) {
|
||||
WLOG(WS_LOG_SFTP, "Unable to seek input file");
|
||||
ssh->error = WS_BAD_FILE_E;
|
||||
ret = WS_FATAL_ERROR;
|
||||
/* no remote handle to close yet */
|
||||
state->handleSz = 0;
|
||||
state->state = STATE_PUT_CLOSE_LOCAL;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#else /* USE_WINDOWS_API */
|
||||
state->fileHandle = WS_CreateFileA(from, GENERIC_READ,
|
||||
|
|
|
|||
Loading…
Reference in New Issue