Skip to content
Closed
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: 11 additions & 0 deletions src/wolfsftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4658,11 +4658,16 @@ int wolfSSH_SFTP_RecvRename(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
}


#ifndef WOLFSSH_MAX_SFTP_HANDLES
Comment thread
ejohnstown marked this conversation as resolved.
Comment thread
ejohnstown marked this conversation as resolved.
Comment thread
ejohnstown marked this conversation as resolved.
#define WOLFSSH_MAX_SFTP_HANDLES 64
#endif

/* add a name and handle to the handle list
* return WS_SUCCESS on success */
int SFTP_AddHandleNode(WOLFSSH* ssh, byte* handle, word32 handleSz, const char* name)
{
WS_HANDLE_LIST* cur;
word32 count = 0;
int sz;

if (ssh == NULL || handle == NULL || name == NULL) {
Expand All @@ -4673,6 +4678,12 @@ int SFTP_AddHandleNode(WOLFSSH* ssh, byte* handle, word32 handleSz, const char*
return WS_BUFFER_E;
}

for (cur = ssh->handleList; cur != NULL; cur = cur->next) {
Comment thread
ejohnstown marked this conversation as resolved.
if (++count >= WOLFSSH_MAX_SFTP_HANDLES) {
Comment thread
ejohnstown marked this conversation as resolved.
return WS_MEMORY_E;
}
}

cur = (WS_HANDLE_LIST*)WMALLOC(sizeof(WS_HANDLE_LIST), ssh->ctx->heap,
DYNTYPE_SFTP);
if (cur == NULL) {
Expand Down
Loading