]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check that 'e' and 'n' are allocated in opensslrsa_fromdns
authorMark Andrews <marka@isc.org>
Mon, 26 Sep 2022 01:57:17 +0000 (11:57 +1000)
committerMark Andrews <marka@isc.org>
Wed, 28 Sep 2022 00:06:39 +0000 (10:06 +1000)
(cherry picked from commit db70c302138f02b6e1fca6e89cf2da35b2ca0ae4)

lib/dns/opensslrsa_link.c

index b23b6323fac1ccf62a0896815e43f57534af237d..b744a62df98ee3b98db99b338cddda9e9ff38ccd 100644 (file)
@@ -671,6 +671,11 @@ 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) {
+               RSA_free(rsa);
+               return (ISC_R_NOMEMORY);
+       }
+
        if (RSA_set0_key(rsa, n, e, NULL) == 0) {
                if (n != NULL) {
                        BN_free(n);