diff options
author | milo <milo@r0ot.me> | 2011-05-02 17:30:43 +0200 |
---|---|---|
committer | milo <milo@r0ot.me> | 2011-05-02 17:30:43 +0200 |
commit | b6e712e934a45981b3a12cb67b48df006402a4d7 (patch) | |
tree | bced5a27bee4f5aa91ef608e32aa36ca2759a8ee /src/auth.c | |
parent | 7d2064c2894fc298cc8923cae657200900b032e5 (diff) | |
download | libssh-b6e712e934a45981b3a12cb67b48df006402a4d7.tar.gz libssh-b6e712e934a45981b3a12cb67b48df006402a4d7.tar.xz libssh-b6e712e934a45981b3a12cb67b48df006402a4d7.zip |
Fix segfault when ssh_userauth_kbdint_setanswer() has not been called
Diffstat (limited to 'src/auth.c')
-rw-r--r-- | src/auth.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1828,6 +1828,11 @@ static int kbdauth_send(ssh_session session) { 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 || buffer_add_u32(session->out_buffer, htonl(session->kbdint->nprompts)) < 0) { @@ -2067,8 +2072,10 @@ int ssh_userauth_kbdint_getnanswers(ssh_session session) { * @return 0 on success, < 0 on error. */ 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; + } if (i > session->kbdint->nanswers) { return NULL; } |