Files
linux-stable-mirror/kernel
Ricardo RobainaandGreg Kroah-Hartman e82735d5d3 audit: fix potential integer overflow in audit_log_n_hex()
[ Upstream commit 65dfde57d1 ]

The function calculates new_len as len << 1 for hex encoding. This
has two overflow risks: the shift itself can overflow when len is
large, and the result can be truncated when assigned to new_len
(declared as int) from the size_t calculation.

Fix by using check_shl_overflow() to catch shift overflow and
changing new_len and loop counter i to size_t to prevent truncation.

Cc: stable@vger.kernel.org
Fixes: 168b717395 ("AUDIT: Clean up logging of untrusted strings")
Reviewed-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Ricardo Robaina <rrobaina@redhat.com>
[PM: remove vertical whitspace noise]
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-07-24 15:55:17 +02:00
..
2025-12-07 06:12:35 +09:00
2022-09-26 10:13:13 -07:00
2023-12-20 17:00:20 +01:00
2023-11-28 17:06:57 +00:00
2021-05-07 00:26:33 -07:00
2024-10-17 15:22:28 +02:00
2022-02-25 09:36:06 +01:00
2020-08-19 14:13:20 +02:00