diff options
Diffstat (limited to 'examples/authentication.c')
-rw-r--r-- | examples/authentication.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/authentication.c b/examples/authentication.c index 988ed91..3add1b2 100644 --- a/examples/authentication.c +++ b/examples/authentication.c @@ -44,7 +44,9 @@ int authenticate_kbdint(ssh_session session){ prompt=ssh_userauth_kbdint_getprompt(session,i,&echo); if(echo){ printf("%s",prompt); - fgets(buffer,sizeof(buffer),stdin); + if (fgets(buffer,sizeof(buffer),stdin) == NULL) { + return SSH_AUTH_ERROR; + } buffer[sizeof(buffer)-1]=0; if((ptr=strchr(buffer,'\n'))) *ptr=0; |