From fc8f9f4331ac9446b7086fbaee28aeb336740836 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 0c9dc5c2f4..33a6336aa5 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -293,8 +293,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; }