Skip to content

Commit eab0488

Browse files
committed
Fix octal validation loop index in GetScpFileMode
The upper-bound check in the octal-to-integer conversion loop used modeOctet[0] instead of modeOctet[i], so only the first character was validated against '7'. Characters at positions 1-3 could have values above '7' without triggering an error.
1 parent 6547f04 commit eab0488

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wolfscp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ static int GetScpFileMode(WOLFSSH* ssh, byte* buf, word32 bufSz,
854854

855855
for (i = 0; i < SCP_MODE_OCTET_LEN; i++)
856856
{
857-
if (modeOctet[i] < '0' || modeOctet[0] > '7') {
857+
if (modeOctet[i] < '0' || modeOctet[i] > '7') {
858858
ret = WS_BAD_ARGUMENT;
859859
break;
860860
}

0 commit comments

Comments
 (0)