Fixes after reviewer's comments

pull/324/head
Daniele Lacamera 2021-03-22 17:40:12 +01:00
parent 5169432e39
commit f128bea779
1 changed files with 5 additions and 3 deletions

View File

@ -1042,7 +1042,6 @@ static int GetScpTimestamp(WOLFSSH* ssh, byte* buf, word32 bufSz,
return ret; return ret;
} }
#ifndef NO_FILESYSTEM
/* checks for if directory is being renamed in command /* checks for if directory is being renamed in command
* *
* returns WS_SUCCESS on success * returns WS_SUCCESS on success
@ -1058,6 +1057,10 @@ static int ScpCheckForRename(WOLFSSH* ssh, int cmdSz)
return WS_BUFFER_E; return WS_BUFFER_E;
} }
if (cmdSz + 4 > DEFAULT_SCP_MSG_SZ) {
return WS_BUFFER_E;
}
WSTRNCPY(buf, ssh->scpBasePath, cmdSz); WSTRNCPY(buf, ssh->scpBasePath, cmdSz);
buf[sz] = '\0'; buf[sz] = '\0';
WSTRNCAT(buf, "/..", sizeof("/..")); WSTRNCAT(buf, "/..", sizeof("/.."));
@ -1118,15 +1121,14 @@ static int ScpCheckForRename(WOLFSSH* ssh, int cmdSz)
return WS_SUCCESS; return WS_SUCCESS;
} }
#endif
/* helps with checking if the base path is a directory or file /* helps with checking if the base path is a directory or file
* returns WS_SUCCESS on success */ * returns WS_SUCCESS on success */
static int ParseBasePathHelper(WOLFSSH* ssh, int cmdSz) static int ParseBasePathHelper(WOLFSSH* ssh, int cmdSz)
{ {
int ret = 0; int ret = 0;
#ifndef NO_FILESYSTEM
ret = ScpCheckForRename(ssh, cmdSz); ret = ScpCheckForRename(ssh, cmdSz);
#ifndef NO_FILESYSTEM
{ {
ScpSendCtx ctx; ScpSendCtx ctx;