Skip to content

Commit ee59f31

Browse files
ejohnstownpadelsbach
authored andcommitted
sftp: check DoStatus return in DoName
Capture the return value, clear state unconditionally, and report parse failure or non-OK server status via ssh->error instead of discarding the result. Issue: CID 572873
1 parent e931db6 commit ee59f31

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/wolfsftp.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6390,9 +6390,14 @@ static WS_SFTPNAME* wolfSSH_SFTP_DoName(WOLFSSH* ssh)
63906390
}
63916391

63926392
wolfSSH_SFTP_buffer_rewind(&state->buffer);
6393-
wolfSSH_SFTP_DoStatus(ssh, reqId, &state->buffer);
6394-
if (!NoticeError(ssh)) {
6395-
wolfSSH_SFTP_ClearState(ssh, STATE_ID_NAME);
6393+
ret = wolfSSH_SFTP_DoStatus(ssh, reqId, &state->buffer);
6394+
wolfSSH_SFTP_ClearState(ssh, STATE_ID_NAME);
6395+
if (ret < 0) {
6396+
ssh->error = ret;
6397+
}
6398+
else if (ret != WOLFSSH_FTP_OK) {
6399+
WLOG(WS_LOG_SFTP, "SFTP server returned status %d", ret);
6400+
ssh->error = WS_SFTP_STATUS_NOT_OK;
63966401
}
63976402
return NULL;
63986403
}

0 commit comments

Comments
 (0)