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.
This commit is contained in:
Ingo Klöcker 2022-11-11 11:43:57 +01:00
parent b6593bda1f
commit 6bcfbb3498
No known key found for this signature in database
GPG Key ID: F5A5D1692277A1E9

View File

@ -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);