From 83b0ce7275037f4656df597e6509630bb8e7a0c1 Mon Sep 17 00:00:00 2001 From: Herman Semenoff Date: Sun, 23 Nov 2025 09:56:45 +0300 Subject: [PATCH] xfree86: fix infinite boot when parsing incorrect BusID section Device This change checks if there is a colon after the bus name. If there is none, *retID will point to the final null character of the original string. --- hw/xfree86/common/xf86Bus.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 4458fd8a01..8c07d0e559 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -290,8 +290,13 @@ StringToBusType(const char *busID, const char **retID) if (!xf86NameCmp(p, "usb")) ret = BUS_USB; if (ret != BUS_NONE) - if (retID) - *retID = busID + strlen(p) + 1; + if (retID) { + size_t len = strlen(p); + if (busID[len] == ':') + *retID = busID + len + 1; + else + *retID = busID + len; /* Points to the terminating null byte */ + } free(s); return ret; }