1
1

Fix segfault when ssh_userauth_kbdint_setanswer() has not been called

Этот коммит содержится в:
milo 2011-05-02 17:30:43 +02:00
родитель 7d2064c289
Коммит b6e712e934

Просмотреть файл

@ -1828,6 +1828,11 @@ static int kbdauth_send(ssh_session session) {
enter_function(); enter_function();
if(session==NULL || session->kbdint == NULL
|| session->kbdint->answers == NULL) {
return rc;
}
if (buffer_add_u8(session->out_buffer, SSH2_MSG_USERAUTH_INFO_RESPONSE) < 0 || if (buffer_add_u8(session->out_buffer, SSH2_MSG_USERAUTH_INFO_RESPONSE) < 0 ||
buffer_add_u32(session->out_buffer, buffer_add_u32(session->out_buffer,
htonl(session->kbdint->nprompts)) < 0) { htonl(session->kbdint->nprompts)) < 0) {
@ -2067,8 +2072,10 @@ int ssh_userauth_kbdint_getnanswers(ssh_session session) {
* @return 0 on success, < 0 on error. * @return 0 on success, < 0 on error.
*/ */
const char *ssh_userauth_kbdint_getanswer(ssh_session session, unsigned int i) { const char *ssh_userauth_kbdint_getanswer(ssh_session session, unsigned int i) {
if(session==NULL || session->kbdint == NULL) if(session==NULL || session->kbdint == NULL
|| session->kbdint->answers == NULL) {
return NULL; return NULL;
}
if (i > session->kbdint->nanswers) { if (i > session->kbdint->nanswers) {
return NULL; return NULL;
} }