summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2013-10-10 01:38:11 +0200
committerKay Sievers <kay@vrfy.org>2013-10-10 01:38:11 +0200
commit6c7980093c4e39d07bf06484f96f489e236c7c29 (patch)
tree4b5cfc5ec451582ec136cb09834b61dad7f47c67
parent8552b17660033812080a11533bd0edce74401039 (diff)
do not accept "garbage" from acpi firmware performance data (FPDT)
00000000 46 42 50 54 38 00 00 00 02 00 30 02 00 00 00 00 |FBPT8.....0.....| 00000010 23 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |#E..............| 00000020 f5 6a 51 00 00 00 00 00 00 00 00 00 00 00 00 00 |.jQ.............| 00000030 00 00 00 00 00 00 00 00 70 74 61 6c 58 00 00 00 |........ptalX...|
-rw-r--r--src/shared/acpi-fpdt.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c
index af58c7cca6..75648b4d86 100644
--- a/src/shared/acpi-fpdt.c
+++ b/src/shared/acpi-fpdt.c
@@ -146,6 +146,11 @@ int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
if (brec.type != ACPI_FPDT_BOOT_REC)
return -EINVAL;
+ if (brec.startup_start == 0 || brec.exit_services_exit < brec.startup_start)
+ return -EINVAL;
+ if (brec.exit_services_exit > NSEC_PER_HOUR)
+ return -EINVAL;
+
if (loader_start)
*loader_start = brec.startup_start / 1000;
if (loader_exit)