fwts/acpi-pmtt-fix-infinite-loops-when-length-is-incorrectly-zero.diff
Martin Pluskal a21cb6636a - Add patch fixing bsc#1178442 bsc#1177992
* acpi-pmtt-fix-infinite-loops-when-length-is-incorrectly-zero.diff

OBS-URL: https://build.opensuse.org/package/show/hardware/fwts?expand=0&rev=118
2021-01-18 08:40:01 +00:00

37 lines
1.3 KiB
Diff

Index: fwts-20.12.00/src/acpi/pmtt/pmtt.c
===================================================================
--- fwts-20.12.00.orig/src/acpi/pmtt/pmtt.c
+++ fwts-20.12.00/src/acpi/pmtt/pmtt.c
@@ -117,6 +117,14 @@ static void pmtt_controller_test(fwts_fr
offset += sizeof(fwts_acpi_table_pmtt_domain) * entry->domain_count;
header = (fwts_acpi_table_pmtt_header *) (((char *) entry) + offset);
while (offset < entry->header.length) {
+
+ if (header->length == 0) {
+ fwts_failed(fw, LOG_LEVEL_CRITICAL,
+ "PMTTBadSubtableLength",
+ "PMTT Controller has a subtable with zero length");
+ break;
+ }
+
if (header->type == FWTS_ACPI_PMTT_TYPE_DIMM) {
pmtt_physical_component_test(fw, (fwts_acpi_table_pmtt_physical_component *) header, passed);
} else {
@@ -145,7 +153,16 @@ static void pmtt_socket_test(fwts_framew
offset = sizeof(fwts_acpi_table_pmtt_socket);
header = (fwts_acpi_table_pmtt_header *) (((char *) entry) + offset);
+
while (offset < entry->header.length) {
+
+ if (header->length == 0) {
+ fwts_failed(fw, LOG_LEVEL_CRITICAL,
+ "PMTTBadSubtableLength",
+ "PMTT Socket has a subtable with zero length");
+ break;
+ }
+
if (header->type == FWTS_ACPI_PMTT_TYPE_CONTROLLER) {
pmtt_controller_test(fw, (fwts_acpi_table_pmtt_controller *) header, passed);
} else {