Skip to content

Commit

Permalink
additional sanity check on input buffer size
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh authored Sep 15, 2023
1 parent d84e3b3 commit ef39490
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/wolfsftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5174,6 +5174,11 @@ int wolfSSH_SFTP_RecvFSetSTAT(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)

WLOG(WS_LOG_SFTP, "Receiving WOLFSSH_FTP_FSETSTAT");

if (maxSz < UINT32_SZ) {
/* not enough for an ato32 call */
return WS_BUFFER_E;
}

/* get file handle */
ato32(data + idx, &sz); idx += UINT32_SZ;
if (sz + idx > maxSz || sz > WOLFSSH_MAX_HANDLE) {
Expand Down

0 comments on commit ef39490

Please sign in to comment.