From 1b7ea889e87388008001efb8b0b38180da276a94 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Mon, 1 Aug 2011 18:59:04 +0200 Subject: [PATCH] check the output of fgets. --- src/p11common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p11common.c b/src/p11common.c index 1ef7c9c53..579d489c4 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; } -- 2.11.4.GIT