From: Pauli Date: Tue, 10 Nov 2020 07:05:30 +0000 (+1000) Subject: rsa_test: add return value check X-Git-Tag: openssl-3.0.0-alpha9~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93c87f745d5694b829d5b52d371d478b063a1fba;p=thirdparty%2Fopenssl.git rsa_test: add return value check Fixes #13361 Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/13362) --- diff --git a/test/rsa_test.c b/test/rsa_test.c index 67f29808810..5e7529876af 100644 --- a/test/rsa_test.c +++ b/test/rsa_test.c @@ -231,18 +231,20 @@ static int pad_unknown(void) static int rsa_setkey(RSA** key, unsigned char* ctext, int idx) { int clen = 0; + *key = RSA_new(); - switch (idx) { - case 0: - clen = key1(*key, ctext); - break; - case 1: - clen = key2(*key, ctext); - break; - case 2: - clen = key3(*key, ctext); - break; - } + if (*key != NULL) + switch (idx) { + case 0: + clen = key1(*key, ctext); + break; + case 1: + clen = key2(*key, ctext); + break; + case 2: + clen = key3(*key, ctext); + break; + } return clen; }