From db70c302138f02b6e1fca6e89cf2da35b2ca0ae4 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 26 Sep 2022 11:57:17 +1000 Subject: [PATCH] Check that 'e' and 'n' are allocated in opensslrsa_fromdns --- lib/dns/opensslrsa_link.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/dns/opensslrsa_link.c b/lib/dns/opensslrsa_link.c index 64287854cc..ce40ab1c31 100644 --- a/lib/dns/opensslrsa_link.c +++ b/lib/dns/opensslrsa_link.c @@ -692,6 +692,9 @@ opensslrsa_fromdns(dst_key_t *key, isc_buffer_t *data) { e = BN_bin2bn(r.base, e_bytes, NULL); isc_region_consume(&r, e_bytes); n = BN_bin2bn(r.base, r.length, NULL); + if (e == NULL || n == NULL) { + DST_RET(ISC_R_NOMEMORY); + } key->key_size = BN_num_bits(n);