Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/wolfsftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -6710,17 +6710,14 @@ int wolfSSH_SFTP_SendWritePacket(WOLFSSH* ssh, byte* handle, word32 handleSz,
WLOG(WS_LOG_SFTP, "SFTP SEND_WRITE STATE: SEND_BODY");
state->sentSz = wolfSSH_stream_send(ssh, in, inSz);
if (state->sentSz == WS_WINDOW_FULL ||
state->sentSz == WS_REKEYING) {
state->sentSz == WS_REKEYING ||
state->sentSz == WS_WANT_READ ||
state->sentSz == WS_WANT_WRITE) {
ret = wolfSSH_worker(ssh, NULL);
if (ret == WS_SUCCESS)
continue; /* skip past rest and send more */
continue; /* skip past rest and send more */
}

if (state->sentSz <= 0) {
if (ssh->error == WS_WANT_READ ||
ssh->error == WS_WANT_WRITE) {
return WS_FATAL_ERROR;
}
ssh->error = state->sentSz;
ret = WS_FATAL_ERROR;
state->state = STATE_SEND_WRITE_CLEANUP;
Expand Down
6 changes: 4 additions & 2 deletions wolfssh/wolfsftp.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,14 @@ struct WS_SFTPNAME {
/*
* WOLFSSH_MAX_SFTP_RW: Limit on how much file data the client will request
* or send in a file transfer message. Also a limit on how much file
* data a server will send per request from the client.
* data a server will send per request from the client. Most SFTP clients
* will allow the peer to send less than requested, but one in particular
* expects the amount requested to be sent, and that's 32kiB.
* WOLFSSH_MAX_SFTP_RECV: Used as a bounds check on a SFTP message's size.
* Is not used to allocate any buffers directly.
*/
#ifndef WOLFSSH_MAX_SFTP_RW
#define WOLFSSH_MAX_SFTP_RW 1024
#define WOLFSSH_MAX_SFTP_RW 32768
#endif
#ifndef WOLFSSH_MAX_SFTP_RECV
#define WOLFSSH_MAX_SFTP_RECV 32768
Expand Down