diff options
author | Ben Kibbey <bjk@luxsci.net> | 2011-09-13 02:13:19 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2011-09-13 08:33:43 +0200 |
commit | 0dcf517700387e75ce46c28993f882031e34c816 (patch) | |
tree | 10e97679cf70518a87f575eeb68ca2313ec9d9a8 /agent/genkey.c | |
parent | Fixed invalid free. (diff) | |
download | gnupg2-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.c | 9 |
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; } |