From: Zhou Qingyang Date: Mon, 24 Jan 2022 17:37:59 +0000 (+0800) Subject: Add the missing check of BN_bn2hex return value X-Git-Tag: openssl-3.2.0-alpha1~3011 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4dd085c03a885580cc945f71187131ea7fb39b70;p=thirdparty%2Fopenssl.git Add the missing check of BN_bn2hex return value CLA: trivial Signed-off-by: Zhou Qingyang Reviewed-by: Paul Dale Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/17578) --- diff --git a/providers/implementations/encode_decode/encode_key2text.c b/providers/implementations/encode_decode/encode_key2text.c index f8f9712e961..9455f97c4a9 100644 --- a/providers/implementations/encode_decode/encode_key2text.c +++ b/providers/implementations/encode_decode/encode_key2text.c @@ -80,6 +80,9 @@ static int print_labeled_bignum(BIO *out, const char *label, const BIGNUM *bn) } hex_str = BN_bn2hex(bn); + if (hex_str == NULL) + return 0; + p = hex_str; if (*p == '-') { ++p;