]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: don't pass null pointer to string functions [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 1 Oct 2013 15:26:33 +0000 (17:26 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 1 Oct 2013 15:26:33 +0000 (17:26 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-dmi.c

index 8f02779d6e7f2cad0ccba2e54d3d0a0b3f531083..852817df1632382d74e0df2159e09821ac4dded1 100644 (file)
@@ -155,11 +155,12 @@ static int hypervisor_from_dmi_table(uint32_t base, uint16_t len,
                data = next;
                i++;
        }
-       if (!strcmp(manufacturer, "innotek GmbH"))
+       if (manufacturer && !strcmp(manufacturer, "innotek GmbH"))
                return HYPER_INNOTEK;
-       else if (strstr(manufacturer, "HITACHI") && strstr(product, "LPAR"))
+       else if (manufacturer && strstr(manufacturer, "HITACHI") &&
+                                       product && strstr(product, "LPAR"))
                return HYPER_HITACHI;
-       else if (!strcmp(vendor, "Parallels"))
+       else if (!vendor && strcmp(vendor, "Parallels"))
                return HYPER_PARALLELS;
 
        free(buf);