Skip to content

Commit 9cb60cd

Browse files
committed
DoUserAuthRequestPassword Missing Bounds Check
Replace the original message parsing functions with the GetStringRef() function, which does better bounds checking. Affected function: DoUserAuthRequestPassword. Issue: F-411
1 parent a8ad9f0 commit 9cb60cd

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/internal.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6890,20 +6890,14 @@ static int DoUserAuthRequestPassword(WOLFSSH* ssh, WS_UserAuthData* authData,
68906890
}
68916891

68926892
if (ret == WS_SUCCESS)
6893-
ret = GetUint32(&pw->passwordSz, buf, len, &begin);
6893+
ret = GetStringRef(&pw->passwordSz, &pw->password, buf, len, &begin);
68946894

68956895
if (ret == WS_SUCCESS) {
6896-
pw->password = buf + begin;
6897-
begin += pw->passwordSz;
6898-
68996896
if (pw->hasNewPassword) {
69006897
/* Skip the password change. Maybe error out since we aren't
69016898
* supporting password changes at this time. */
6902-
ret = GetUint32(&pw->newPasswordSz, buf, len, &begin);
6903-
if (ret == WS_SUCCESS) {
6904-
pw->newPassword = buf + begin;
6905-
begin += pw->newPasswordSz;
6906-
}
6899+
ret = GetStringRef(&pw->newPasswordSz, &pw->newPassword,
6900+
buf, len, &begin);
69076901
}
69086902
else {
69096903
pw->newPassword = NULL;

0 commit comments

Comments
 (0)