summaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-11-28 13:36:56 +0100
committerJustus Winter <justus@g10code.com>2016-11-28 13:48:19 +0100
commit4db9a425644dccaf81b51ebc97b32a9cc21941a4 (patch)
treefb5be0072f64b9b85811271428141829f711e8aa /g10
parenttests: Rename ssh test. (diff)
downloadgnupg2-4db9a425644dccaf81b51ebc97b32a9cc21941a4.tar.xz
gnupg2-4db9a425644dccaf81b51ebc97b32a9cc21941a4.zip
g10: Fix iteration over getkey results.
* g10/getkey.c (getkey_next): Only ask 'lookup' for the exact match if our caller requested the key. Fixes a crash in 'lookup'. GnuPG-bug-id: 2848 Fixes-commit: 1d03cc77e1706f7da653153ad4b58c61e4fd2573 Signed-off-by: Justus Winter <justus@g10code.com>
Diffstat (limited to 'g10')
-rw-r--r--g10/getkey.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index 68e6a1bf0..6eec087cf 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -2178,7 +2178,7 @@ getkey_next (getkey_ctx_t ctx, PKT_public_key *pk, kbnode_t *ret_keyblock)
if (pk && ret_keyblock == NULL)
ret_keyblock = &keyblock;
- rc = lookup (ctx, ret_keyblock, &found_key, ctx->want_secret);
+ rc = lookup (ctx, ret_keyblock, pk ? &found_key : NULL, ctx->want_secret);
if (!rc && pk)
{
log_assert (found_key);