From 0995b1a180e24ebc0383621d3d5bfaff98e1f877 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Sat, 7 Sep 2024 12:44:42 +0200 Subject: [PATCH] Add NULL check to _gpgme_key_to_ProfPGPKey Fix https://github.com/profanity-im/profanity/issues/1995 Tested-by: Martin Dosch --- src/pgp/gpg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pgp/gpg.c b/src/pgp/gpg.c index 282689559..8cb903624 100644 --- a/src/pgp/gpg.c +++ b/src/pgp/gpg.c @@ -860,7 +860,8 @@ p_gpg_import_pubkey(const char* buffer) static ProfPGPKey* _gpgme_key_to_ProfPGPKey(gpgme_key_t key) { - if (key == NULL) { + if (key == NULL || key->uids == NULL + || key->subkeys == NULL || key->uids->uid == NULL) { return NULL; }