summaryrefslogtreecommitdiffstats
path: root/agent/genkey.c
diff options
context:
space:
mode:
authorBen Kibbey <bjk@luxsci.net>2011-09-13 02:13:19 +0200
committerWerner Koch <wk@gnupg.org>2011-09-13 08:33:43 +0200
commit0dcf517700387e75ce46c28993f882031e34c816 (patch)
tree10e97679cf70518a87f575eeb68ca2313ec9d9a8 /agent/genkey.c
parentFixed invalid free. (diff)
downloadgnupg2-0dcf517700387e75ce46c28993f882031e34c816.tar.xz
gnupg2-0dcf517700387e75ce46c28993f882031e34c816.zip
Allow no protection in pinentry-mode=loopback.
When the inquired passphrase has a 0 length then treat it as no protection.
Diffstat (limited to '')
-rw-r--r--agent/genkey.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/agent/genkey.c b/agent/genkey.c
index b02268497..20b9230bd 100644
--- a/agent/genkey.c
+++ b/agent/genkey.c
@@ -313,8 +313,13 @@ agent_ask_new_passphrase (ctrl_t ctrl, const char *prompt,
err = pinentry_loopback(ctrl, "NEW_PASSPHRASE", &buffer, &size, len);
if (!err)
{
- buffer[size] = 0;
- *r_passphrase = buffer;
+ if (size)
+ {
+ buffer[size] = 0;
+ *r_passphrase = buffer;
+ }
+ else
+ *r_passphrase = NULL;
}
return err;
}