Skip to content

Commit 5dfb0a7

Browse files
Viktor Dukhovnizvonand
authored andcommitted
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 <[email protected]> Reviewed-by: Matt Caswell <[email protected]> Reviewed-by: Tomas Mraz <[email protected]>
1 parent 66deddc commit 5dfb0a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crypto/cms/cms_pwri.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ static int kek_unwrap_key(unsigned char *out, size_t *outlen,
237237
/* Check byte failure */
238238
goto err;
239239
}
240-
if (inlen < (size_t)(tmp[0] - 4)) {
240+
if (inlen < 4 + (size_t)tmp[0]) {
241241
/* Invalid length value */
242242
goto err;
243243
}

0 commit comments

Comments
 (0)