]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
rsa_enc.c: Properly duplicate the oaep_label member
authorTomas Mraz <tomas@openssl.org>
Wed, 21 Jan 2026 18:11:30 +0000 (19:11 +0100)
committerNorbert Pocs <norbertp@openssl.org>
Fri, 23 Jan 2026 10:40:21 +0000 (11:40 +0100)
Otherwise UAF and doublefree appears when the duplicate
is freed.
Reported by Tomas Dulka and Stanislav Fort (Aisle Research)

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Jan 23 10:40:31 2026
(Merged from https://github.com/openssl/openssl/pull/29707)

providers/implementations/asymciphers/rsa_enc.c

index 6a82f8821768247b37caa8381dc6c6950baee372..6cbd01cbc5ccbc71f4da6d978ba2f36e0c547911 100644 (file)
@@ -332,6 +332,12 @@ static void *rsa_dupctx(void *vprsactx)
         return NULL;
     }
 
+    if (dstctx->oaep_label != NULL
+        && (dstctx->oaep_label = OPENSSL_memdup(dstctx->oaep_label, dstctx->oaep_labellen)) == NULL) {
+        rsa_freectx(dstctx);
+        return NULL;
+    }
+
     return dstctx;
 }