From 7707aa24d672de5d03ae7e66fbc2fd525dc9a24d Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Sat, 10 Oct 2015 00:58:11 +0100 Subject: [PATCH] rsa2_pubkey_bits: Cope correctly with a NULL return from rsa2_newkey() Dereferencing it is not correct. Bug found with the help of afl-fuzz. --- sshrsa.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sshrsa.c b/sshrsa.c index 850204c7..e565a64a 100644 --- a/sshrsa.c +++ b/sshrsa.c @@ -773,6 +773,8 @@ static int rsa2_pubkey_bits(const struct ssh_signkey *self, int ret; rsa = rsa2_newkey(self, (const char *) blob, len); + if (!rsa) + return -1; ret = bignum_bitcount(rsa->modulus); rsa2_freekey(rsa); -- 2.45.2