git: 8ebb0781f536 - stable/14 - acpidump: do not use pointer arithmetic to check for overflow
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 05 Mar 2025 00:51:47 UTC
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8ebb0781f536be8805975a75bea9be1fa453f1bd commit 8ebb0781f536be8805975a75bea9be1fa453f1bd Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2025-02-26 05:24:30 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2025-03-05 00:51:29 +0000 acpidump: do not use pointer arithmetic to check for overflow PR: 204945 (cherry picked from commit 8c108dccd7f878ad44aaef1f5bfb5622666bd09a) --- usr.sbin/acpi/acpidump/acpi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c index 31c3045ab6ea..385a0a3c36fd 100644 --- a/usr.sbin/acpi/acpidump/acpi.c +++ b/usr.sbin/acpi/acpidump/acpi.c @@ -1222,13 +1222,14 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) vend = vaddr + len; while (vaddr != NULL) { - if ((vaddr + sizeof(struct TCPAevent) >= vend)|| - (vaddr + sizeof(struct TCPAevent) < vaddr)) + if ((uintptr_t)vaddr + sizeof(struct TCPAevent) >= + (uintptr_t)vend || (uintptr_t)vaddr + sizeof( + struct TCPAevent) < (uintptr_t)vaddr) break; event = (struct TCPAevent *)(void *)vaddr; - if (vaddr + event->event_size >= vend) + if ((uintptr_t)vaddr + event->event_size >= (uintptr_t)vend) break; - if (vaddr + event->event_size < vaddr) + if ((uintptr_t)vaddr + event->event_size < (uintptr_t)vaddr) break; if (event->event_type == 0 && event->event_size == 0) break;