From: Nikos Mavrogiannopoulos Date: Wed, 25 Jun 2014 13:29:35 +0000 (+0200) Subject: p11tool: Do not allow a newline as PIN. X-Git-Tag: gnutls_3_3_5~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=09d9a00340f6191de5019ed8fc0affbbafa8cfe1;p=thirdparty%2Fgnutls.git p11tool: Do not allow a newline as PIN. --- diff --git a/src/common.c b/src/common.c index d878ecf29d..f468de07b7 100644 --- a/src/common.c +++ b/src/common.c @@ -1026,17 +1026,17 @@ pin_callback(void *user, int attempt, const char *token_url, password = getenv("GNUTLS_PIN"); - if (password == NULL) + if (password == NULL) { password = getpass("Enter PIN: "); - else { + } else { if (flags & GNUTLS_PIN_WRONG) { fprintf(stderr, "Cannot continue with a wrong password in the environment.\n"); exit(1); } } - if (password == NULL || password[0] == 0) { - fprintf(stderr, "No password given\n"); + if (password == NULL || password[0] == 0 || password[0] == '\n') { + fprintf(stderr, "No PIN given\n"); exit(1); }