Skip to content

Commit

Permalink
add sanity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Oct 10, 2024
1 parent 52e4e32 commit 8a1b62f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -15720,16 +15720,22 @@ int wolfSSH_GetPath(const char* defaultPath, byte* in, word32 inSz,
}

if (out != NULL) {
WMEMCPY(out + curSz, in, inSz);
if (curSz + inSz < *outSz) {
WMEMCPY(out + curSz, in, inSz);
}
}
curSz += inSz;
if (out != NULL) {
if (!WOLFSSH_SFTP_IS_DELIM(out[0])) {
WMEMMOVE(out+1, out, curSz);
out[0] = '/';
if (curSz + 1 < *outSz) {
WMEMMOVE(out+1, out, curSz);
out[0] = '/';
}
curSz++;
}
out[curSz] = 0;
if (curSz < *outSz) {
out[curSz] = 0;
}
}
*outSz = curSz;

Expand Down

0 comments on commit 8a1b62f

Please sign in to comment.