If pr_list_start() was called, pr_list_end() must be called too. The
bug would cause pr_list_end() not to be called for type 0 records of
length 18 or 19. This doesn't really matter for now because this is
a no-op for plain text output, but it would break the upcoming JSON
output.

Bug found while reviewing Jiri Hnidek's work.

Signed-off-by: Jean Delvare <jdelv...@suse.de>
---
 dmidecode.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- dmidecode.orig/dmidecode.c
+++ dmidecode/dmidecode.c
@@ -4496,11 +4496,11 @@ static void dmi_decode(const struct dmi_
                        dmi_bios_rom_size(data[0x09], h->length < 0x1A ? 16 : 
WORD(data + 0x18));
                        pr_list_start("Characteristics", NULL);
                        dmi_bios_characteristics(QWORD(data + 0x0A));
+                       if (h->length >= 0x13)
+                               dmi_bios_characteristics_x1(data[0x12]);
+                       if (h->length >= 0x14)
+                               dmi_bios_characteristics_x2(data[0x13]);
                        pr_list_end();
-                       if (h->length < 0x13) break;
-                       dmi_bios_characteristics_x1(data[0x12]);
-                       if (h->length < 0x14) break;
-                       dmi_bios_characteristics_x2(data[0x13]);
                        if (h->length < 0x18) break;
                        if (data[0x14] != 0xFF && data[0x15] != 0xFF)
                                pr_attr("BIOS Revision", "%u.%u",


-- 
Jean Delvare
SUSE L3 Support

Reply via email to