From 35133852e7a739bc30d0bc6cb6fbc640192975ae Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Fri, 14 Aug 2015 14:14:16 +0200 Subject: [PATCH] xfree86: Prevent crash with non-pci graphics cards If a device supports pci but doesn't have its graphics on PCI their busid might very well be NULL. So check that for that before passing NULL to strncmp and crashing. Signed-off-by: Sjoerd Simons --- hw/xfree86/common/xf86platformBus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c index f1e9423..bff5862 100644 --- a/hw/xfree86/common/xf86platformBus.c +++ b/hw/xfree86/common/xf86platformBus.c @@ -290,7 +290,7 @@ xf86platformProbe(void) for (i = 0; i < xf86_num_platform_devices; i++) { char *busid = xf86_platform_odev_attributes(i)->busid; - if (pci && (strncmp(busid, "pci:", 4) == 0)) { + if (pci && busid && (strncmp(busid, "pci:", 4) == 0)) { platform_find_pci_info(&xf86_platform_devices[i], busid); } } -- 2.5.0