summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2011-08-01 18:59:04 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2011-08-01 18:59:04 +0200
commit1b7ea889e87388008001efb8b0b38180da276a94 (patch)
tree4e8cea4e063846b078dc5f9b0953f61ce0bd6fbb
parent89a1f28d397d1bcccb8a0f4a2fdf9cfebecb983e (diff)
downloadgnutls-1b7ea889e87388008001efb8b0b38180da276a94.tar.gz
check the output of fgets.
-rw-r--r--src/p11common.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/p11common.c b/src/p11common.c
index 1ef7c9c538..579d489c44 100644
--- a/src/p11common.c
+++ b/src/p11common.c
@@ -102,6 +102,7 @@ static int
token_callback (void *user, const char *label, const unsigned retry)
{
char buf[32];
+ char *p;
if (retry > 0)
{
@@ -109,7 +110,8 @@ token_callback (void *user, const char *label, const unsigned retry)
return -1;
}
printf ("Please insert token '%s' in slot and press enter\n", label);
- fgets (buf, sizeof (buf), stdin);
+ p = fgets (buf, sizeof (buf), stdin);
+ if (p==NULL) return -1;
return 0;
}