From 6bcfbb3498f02dc86370cd4f2e3ccc5f9163d51a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Fri, 11 Nov 2022 11:43:57 +0100 Subject: [PATCH] core: Check for nullptr * src/edit.c (interact_start, edit_start): Return error if key is null. -- This prevents a crash further down the road. --- src/edit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/edit.c b/src/edit.c index a7d2bb51..dd1fe669 100644 --- a/src/edit.c +++ b/src/edit.c @@ -127,7 +127,7 @@ interact_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t key, if (err) return err; - if (!fnc || !out) + if (!key || !fnc || !out) return gpg_error (GPG_ERR_INV_VALUE); err = _gpgme_op_data_lookup (ctx, OPDATA_EDIT, &hook, sizeof (*opd), NULL); @@ -206,7 +206,7 @@ edit_start (gpgme_ctx_t ctx, int synchronous, int type, gpgme_key_t key, if (err) return err; - if (!fnc || !out) + if (!key || !fnc || !out) return gpg_error (GPG_ERR_INV_VALUE); err = _gpgme_op_data_lookup (ctx, OPDATA_EDIT, &hook, sizeof (*opd), NULL);