]> 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>
Wed, 28 Sep 2022 00:06:39 +0000 (10:06 +1000)
(cherry picked from commit a47235f4f5af0286aadd43eeccf946a8f35a5dc8)

lib/dns/opensslrsa_link.c

index 9bee2f0449b8338b4b2dab62348d2f29086efd07..45570dac98875120629329d9eb4d1db001a81ff3 100644 (file)
@@ -849,6 +849,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) {
@@ -859,6 +862,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) {