[PATCH GnuPG 5/7] g10: check null in assert
Sam James
sam at gentoo.org
Wed Jan 28 13:35:05 CET 2026
* g10/keyedit.c (keyedit_quick_revsig): Check 'keyblock' in log_assert.
--
Found by GCC's -fanalyzer.
Signed-off-by: Sam James <sam at gentoo.org>
---
g10/keyedit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/g10/keyedit.c b/g10/keyedit.c
index 970a72027..567de4efd 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -3306,8 +3306,8 @@ keyedit_quick_revsig (ctrl_t ctrl, const char *username, const char *sigtorev,
err = quick_find_keyblock (ctrl, username, 0, &kdbhd, &keyblock);
if (err)
goto leave;
- log_assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY
- || keyblock->pkt->pkttype == PKT_SECRET_KEY);
+ log_assert (keyblock && (keyblock->pkt->pkttype == PKT_PUBLIC_KEY
+ || keyblock->pkt->pkttype == PKT_SECRET_KEY));
primarypk = keyblock->pkt->pkt.public_key;
primarykid = pk_keyid (primarypk);
--
2.52.0
More information about the Gnupg-devel
mailing list