From: Tomas Mraz Date: Wed, 21 Jan 2026 18:11:30 +0000 (+0100) Subject: rsa_enc.c: Properly duplicate the oaep_label member X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=070c03662302088f718aa9d515b0d547b29297fb;p=thirdparty%2Fopenssl.git rsa_enc.c: Properly duplicate the oaep_label member Otherwise UAF and doublefree appears when the duplicate is freed. Reported by Tomas Dulka and Stanislav Fort (Aisle Research) Reviewed-by: Richard Levitte Reviewed-by: Eugene Syromiatnikov Reviewed-by: Paul Dale MergeDate: Fri Jan 23 10:37:36 2026 (Merged from https://github.com/openssl/openssl/pull/29707) --- diff --git a/providers/implementations/asymciphers/rsa_enc.c b/providers/implementations/asymciphers/rsa_enc.c index c2768c59317..58c76716609 100644 --- a/providers/implementations/asymciphers/rsa_enc.c +++ b/providers/implementations/asymciphers/rsa_enc.c @@ -361,6 +361,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; }