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.
pull/880/head
Andrew Hutchings 2026-02-23 10:19:25 +00:00
parent 6547f04a77
commit eab0488966
1 changed files with 1 additions and 1 deletions

View File

@ -854,7 +854,7 @@ static int GetScpFileMode(WOLFSSH* ssh, byte* buf, word32 bufSz,
for (i = 0; i < SCP_MODE_OCTET_LEN; i++)
{
if (modeOctet[i] < '0' || modeOctet[0] > '7') {
if (modeOctet[i] < '0' || modeOctet[i] > '7') {
ret = WS_BAD_ARGUMENT;
break;
}