File 0001-kek_unwrap_key-Fix-incorrect-check-of-unwrapped-key-.patch of Package mingw64-openssl

From fca323ee45ff6356bf8b5e1b3be117396c6577e4 Mon Sep 17 00:00:00 2001
From: Viktor Dukhovni <openssl-users@dukhovni.org>
Date: Thu, 11 Sep 2025 18:10:12 +0200
Subject: [PATCH 01/11] kek_unwrap_key(): Fix incorrect check of unwrapped key
 size

Fixes CVE-2025-9230

The check is off by 8 bytes so it is possible to overread by
up to 8 bytes and overwrite up to 4 bytes.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(cherry picked from commit 9c462be2cea54ebfc62953224220b56f8ba22a0c)
(cherry picked from commit a79c4ce559c6a3a8fd4109e9f33c1185d5bf2def)
---
 crypto/cms/cms_pwri.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/cms/cms_pwri.c b/crypto/cms/cms_pwri.c
index 5c817caf2f..012cfba330 100644
--- a/crypto/cms/cms_pwri.c
+++ b/crypto/cms/cms_pwri.c
@@ -257,7 +257,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen,
         /* Check byte failure */
         goto err;
     }
-    if (inlen < (size_t)(tmp[0] - 4)) {
+    if (inlen < 4 + (size_t)tmp[0]) {
         /* Invalid length value */
         goto err;
     }
-- 
2.53.0

openSUSE Build Service is sponsored by