mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-15 18:32:26 +03:00
server: Make sure methods is a valid value before casting
Fixes T188 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
@@ -820,12 +820,17 @@ int ssh_message_auth_kbdint_is_response(ssh_message msg) {
|
|||||||
return msg->auth_request.kbdint_response != 0;
|
return msg->auth_request.kbdint_response != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: methods should be unsigned */
|
||||||
int ssh_message_auth_set_methods(ssh_message msg, int methods) {
|
int ssh_message_auth_set_methods(ssh_message msg, int methods) {
|
||||||
if (msg == NULL || msg->session == NULL) {
|
if (msg == NULL || msg->session == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->session->auth.supported_methods = methods;
|
if (methods < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg->session->auth.supported_methods = (uint32_t)methods;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user