postgres.git / summary / log / commit / refs
commit 4a75c7f9f1120db240b4ddccaa7d46f82bb495c0
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Wed Oct 20 19:20:33 2010 +0000
First released in: 9.1.0, 8.1.23, 8.2.19, 8.3.13, 8.4.6, 9.0.2
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 0e9ebb42858..9b44fbfc692 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
*/
[parent: d4346e15b477]