aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2013-05-21 12:00:16 +0000
committerWerner Koch <[email protected]>2013-05-22 07:56:30 +0000
commit0f0e0559f9b160824f10dc17b389268cdb53aea4 (patch)
tree79e464edddca9389d75dcb036882b8c3f96ae680 /agent/command.c
parentagent: New option --disable-check-own-socket. (diff)
downloadgnupg-0f0e0559f9b160824f10dc17b389268cdb53aea4.tar.gz
gnupg-0f0e0559f9b160824f10dc17b389268cdb53aea4.zip
agent: Fix length detection of canonical formatted openpgp keys.
* agent/command.c (cmd_import_key): Pass 0 instead of KEYLEN to gcry_sexp_canon_len. -- We used to pass KEYLEN to the gcry_sexp_canon_len for no good reason: convert_from_openpgp is guaranteed to return a valid canonical S-expression and KEYLEN would thus act only as an upper limit. This is not a problem because usually the original input key is longer than the returned unprotected key. A future patch may change this assertion and thus we better fix this bug now. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'agent/command.c')
-rw-r--r--agent/command.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/agent/command.c b/agent/command.c
index 823b233bf..e57c69d05 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -1924,7 +1924,7 @@ cmd_import_key (assuan_context_t ctx, char *line)
&key, &passphrase);
if (err)
goto leave;
- realkeylen = gcry_sexp_canon_len (key, keylen, NULL, &err);
+ realkeylen = gcry_sexp_canon_len (key, 0, NULL, &err);
if (!realkeylen)
goto leave; /* Invalid canonical encoded S-expression. */
if (passphrase)