mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 16:53:20 -04:00
ACPICA: Fix integer overflow in acpi_ex_opcode_3A_1T_1R() (mid_op)
Add overflow check for Index + Length to prevent integer overflow when calculating the truncation length. This prevents negative size parameter being passed to memcpy(). Link: https://github.com/acpica/acpica/commit/d281ec1ac84e Signed-off-by: ikaros <void0red@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/3760974.R56niFO833@rafael.j.wysocki
This commit is contained in:
committed by
Rafael J. Wysocki
parent
6e8c55e13a
commit
0e2021f49e
@@ -159,7 +159,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
|
||||
|
||||
/* Truncate request if larger than the actual String/Buffer */
|
||||
|
||||
else if ((index + length) > operand[0]->string.length) {
|
||||
else if ((index + length) > operand[0]->string.length || (index + length) < index) { /* Check for overflow */
|
||||
length =
|
||||
(acpi_size)operand[0]->string.length -
|
||||
(acpi_size)index;
|
||||
|
||||
Reference in New Issue
Block a user