daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
65878a
From 113e2da2789ac680d2042993dcf76eef43072f4d Mon Sep 17 00:00:00 2001
65878a
From: Pavel Holica <conscript89@gmail.com>
65878a
Date: Wed, 6 Nov 2013 23:24:16 +0100
65878a
Subject: [PATCH] acpi-fpdt: break on zero or negative length read
65878a
65878a
https://bugzilla.redhat.com/show_bug.cgi?id=1027478
65878a
---
65878a
 src/shared/acpi-fpdt.c | 2 ++
65878a
 1 file changed, 2 insertions(+)
65878a
65878a
diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c
65878a
index 75648b4..7bae47f 100644
65878a
--- a/src/shared/acpi-fpdt.c
65878a
+++ b/src/shared/acpi-fpdt.c
65878a
@@ -109,6 +109,8 @@ int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
65878a
         for (rec = (struct acpi_fpdt_header *)(buf + sizeof(struct acpi_table_header));
65878a
              (char *)rec < buf + l;
65878a
              rec = (struct acpi_fpdt_header *)((char *)rec + rec->length)) {
65878a
+                if (rec->length <= 0)
65878a
+                        break;
65878a
                 if (rec->type != ACPI_FPDT_TYPE_BOOT)
65878a
                         continue;
65878a
                 if (rec->length != sizeof(struct acpi_fpdt_header))