From e170041a5d6ae456527adea6859bc2aa04a5d598 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. Conflicts: sshrsa.c --- sshrsa.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sshrsa.c b/sshrsa.c index 25f9cf7e..5c1991ef 100644 --- a/sshrsa.c +++ b/sshrsa.c @@ -768,6 +768,8 @@ static int rsa2_pubkey_bits(void *blob, int len) int ret; rsa = rsa2_newkey((char *) blob, len); + if (!rsa) + return -1; ret = bignum_bitcount(rsa->modulus); rsa2_freekey(rsa);