From 686ad321641b50f75536faf8c6156cec700eb936 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Wed, 20 Oct 2010 22:20:33 +0300 Subject: [PATCH] If pk is NULL, the backend would segfault when accessing ->algo and the following NULL check was never reached. This problem was found by Coccinelle (null_ref.cocci from coccicheck). Marti Raudsepp --- contrib/pgcrypto/pgp-pubenc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/pgcrypto/pgp-pubenc.c b/contrib/pgcrypto/pgp-pubenc.c index 0e9ebb4285..9b44fbfc69 100644 --- a/contrib/pgcrypto/pgp-pubenc.c +++ b/contrib/pgcrypto/pgp-pubenc.c @@ -199,7 +199,7 @@ pgp_write_pubenc_sesskey(PGP_Context *ctx, PushFilter *dst) PGP_PubKey *pk = ctx->pub_key; uint8 ver = 3; PushFilter *pkt = NULL; - uint8 algo = pk->algo; + uint8 algo; if (pk == NULL) { @@ -207,6 +207,8 @@ pgp_write_pubenc_sesskey(PGP_Context *ctx, PushFilter *dst) return PXE_BUG; } + algo = pk->algo; + /* * now write packet */ -- 2.40.0