From 4db9a425644dccaf81b51ebc97b32a9cc21941a4 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 28 Nov 2016 13:36:56 +0100 Subject: 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 --- g10/getkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3