summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas2010-10-20 19:20:33 +0000
committerHeikki Linnakangas2010-10-20 19:24:04 +0000
commit18e752f226300292c6182b68b2568dc2d66db8bd (patch)
tree89dbcd0ae5078282aa20d7f78f037c71dbc2594b
parentdef30e84c41389225ee9e56cb7c722980bab9746 (diff)
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
-rw-r--r--contrib/pgcrypto/pgp-pubenc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/pgcrypto/pgp-pubenc.c b/contrib/pgcrypto/pgp-pubenc.c
index 4b4d1bfb44..943d2e49f5 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
*/