]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check BN_dup results in rsa_check
authorMark Andrews <marka@isc.org>
Mon, 26 Sep 2022 02:06:44 +0000 (12:06 +1000)
committerMark Andrews <marka@isc.org>
Tue, 27 Sep 2022 23:24:34 +0000 (09:24 +1000)
lib/dns/opensslrsa_link.c

index 2895ce28ceda9c4714b857fe25b0e46844086af7..bc89ca9a089e1e4c8ddf198388af986d88c494ab 100644 (file)
@@ -996,6 +996,9 @@ rsa_check(RSA *rsa, RSA *pub) {
                        }
                } else {
                        n = BN_dup(n2);
+                       if (n == NULL) {
+                               return (ISC_R_NOMEMORY);
+                       }
                }
                if (e1 != NULL) {
                        if (BN_cmp(e1, e2) != 0) {
@@ -1006,6 +1009,12 @@ rsa_check(RSA *rsa, RSA *pub) {
                        }
                } else {
                        e = BN_dup(e2);
+                       if (e == NULL) {
+                               if (n != NULL) {
+                                       BN_free(n);
+                               }
+                               return (ISC_R_NOMEMORY);
+                       }
                }
                if (RSA_set0_key(rsa, n, e, NULL) == 0) {
                        if (n != NULL) {