]> 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:49:04 +0000 (09:49 +1000)
(cherry picked from commit a47235f4f5af0286aadd43eeccf946a8f35a5dc8)

lib/dns/opensslrsa_link.c

index d01d0b03cbb6e1b24a6ddfd8f07e405d88704667..2c5b967aa136169d2524272b7328138a53042a05 100644 (file)
@@ -991,6 +991,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) {
@@ -1001,6 +1004,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) {