Skip to content

Commit 7253bbe

Browse files
author
David Sommerseth
committed
Fixed an issue causing SEGV on some hardware when dmi_processor_id() is called
The dmi_processor_id() function did not check the char *version pointer if it was NULL before doing strcmp(). On some hardware, *version will be NULL.
1 parent 1e9d9ab commit 7253bbe

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/dmidecode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,6 @@ xmlNode *dmi_processor_id(xmlNode *node, u8 type, const u8 * p, const char *vers
10191019
** CPUID instruction or another form of identification.
10201020
*/
10211021

1022-
//. TODO: PyString_FromFormat does not support %x (yet?)...
10231022
dmixml_AddTextChild(data_n, "ID",
10241023
"%02x %02x %02x %02x %02x %02x %02x %02x",
10251024
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
@@ -1075,7 +1074,7 @@ xmlNode *dmi_processor_id(xmlNode *node, u8 type, const u8 * p, const char *vers
10751074

10761075
sig = 2;
10771076

1078-
} else if(type == 0x01 || type == 0x02) {
1077+
} else if(version && (type == 0x01 || type == 0x02)) {
10791078
/*
10801079
** Some X86-class CPU have family "Other" or "Unknown". In this case,
10811080
** we use the version string to determine if they are known to

0 commit comments

Comments
 (0)