]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Free 'rsa' if 'e' is NULL in opensslrsa_verify2
authorMark Andrews <marka@isc.org>
Mon, 26 Sep 2022 01:51:05 +0000 (11:51 +1000)
committerMark Andrews <marka@isc.org>
Tue, 27 Sep 2022 23:53:27 +0000 (09:53 +1000)
(cherry picked from commit a2b51ca6acae9e1c819e0d2e4aa1584b675c4cb7)

lib/dns/opensslrsa_link.c

index b0d8dd85b9ad8f4b145d6077743b4f85bc5a5324..7aa743394b511fc421c37cdc29e033d29da7bc8e 100644 (file)
@@ -333,6 +333,10 @@ opensslrsa_verify2(dst_context_t *dctx, int maxbits, const isc_region_t *sig) {
                return (dst__openssl_toresult(DST_R_OPENSSLFAILURE));
        }
        RSA_get0_key(rsa, NULL, &e, NULL);
+       if (e == NULL) {
+               RSA_free(rsa);
+               return (dst__openssl_toresult(DST_R_VERIFYFAILURE));
+       }
        bits = BN_num_bits(e);
        RSA_free(rsa);
        if (bits > maxbits && maxbits != 0) {