summaryrefslogtreecommitdiffstats
path: root/usr.sbin/acpi
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2017-08-13 18:14:24 +0000
committeremaste <emaste@FreeBSD.org>2017-08-13 18:14:24 +0000
commitcc42cc3073105abe6c81a63216e152498c0d5b00 (patch)
tree4efc4e42ec63d83bed903dc6523a42b3980bfd75 /usr.sbin/acpi
parentdd09ad5d6c72bc35fc129826a5116da9a4271bcc (diff)
downloadFreeBSD-src-cc42cc3073105abe6c81a63216e152498c0d5b00.zip
FreeBSD-src-cc42cc3073105abe6c81a63216e152498c0d5b00.tar.gz
MFC r320736: acpidump: warn and exit loop on invalid subtable length
Submitted by: Guangyuan Yang <yzgyyang@outlook.com> Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin/acpi')
-rw-r--r--usr.sbin/acpi/acpidump/acpi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c
index fc35363..c9e5e1b 100644
--- a/usr.sbin/acpi/acpidump/acpi.c
+++ b/usr.sbin/acpi/acpidump/acpi.c
@@ -275,6 +275,10 @@ acpi_walk_subtables(ACPI_TABLE_HEADER *table, void *first,
end = (char *)table + table->Length;
while ((char *)subtable < end) {
printf("\n");
+ if (subtable->Length < sizeof(ACPI_SUBTABLE_HEADER)) {
+ warnx("invalid subtable length %u", subtable->Length);
+ return;
+ }
action(subtable);
subtable = (ACPI_SUBTABLE_HEADER *)((char *)subtable +
subtable->Length);
OpenPOWER on IntegriCloud