X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Facpi-fpdt.c;h=64e50401b9d0a586a390cbdba8e11fa9af9d3044;hb=17384d7f95169dad5f769431374fc2c08101206d;hp=75648b4d86f91af3a4327c11232d2630c91da6c3;hpb=6c7980093c4e39d07bf06484f96f489e236c7c29;p=elogind.git diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c index 75648b4d8..64e50401b 100644 --- a/src/shared/acpi-fpdt.c +++ b/src/shared/acpi-fpdt.c @@ -19,13 +19,11 @@ along with systemd; If not, see . ***/ -#include #include #include #include #include #include -#include #include #include @@ -83,7 +81,7 @@ struct acpi_fpdt_boot { int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) { _cleanup_free_ char *buf = NULL; struct acpi_table_header *tbl; - size_t l; + size_t l = 0; struct acpi_fpdt_header *rec; int r; uint64_t ptr = 0; @@ -109,6 +107,8 @@ int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) { for (rec = (struct acpi_fpdt_header *)(buf + sizeof(struct acpi_table_header)); (char *)rec < buf + l; rec = (struct acpi_fpdt_header *)((char *)rec + rec->length)) { + if (rec->length <= 0) + break; if (rec->type != ACPI_FPDT_TYPE_BOOT) continue; if (rec->length != sizeof(struct acpi_fpdt_header))