Skip to content

Commit

Permalink
userauth: check for too large userauth_kybd_auth_name_len (libssh2#650)
Browse files Browse the repository at this point in the history
... before using it.

Reported-by: MarcoPoloPie
Fixes libssh2#649
  • Loading branch information
bagder authored Dec 17, 2021
1 parent 6c662e7 commit 37ee0aa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/userauth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1769,6 +1769,11 @@ userauth_keyboard_interactive(LIBSSH2_SESSION * session,
if(session->userauth_kybd_data_len >= 5) {
/* string name (ISO-10646 UTF-8) */
session->userauth_kybd_auth_name_len = _libssh2_ntohu32(s);
if(session->userauth_kybd_auth_name_len >
session->userauth_kybd_data_len - 5)
return _libssh2_error(session,
LIBSSH2_ERROR_OUT_OF_BOUNDARY,
"Bad keyboard auth name");
s += 4;
}
else {
Expand Down

0 comments on commit 37ee0aa

Please sign in to comment.