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.
This commit is contained in:
Herman Semenoff
2025-11-23 09:56:45 +03:00
committed by Enrico Weigelt, metux IT consult
parent 70b3821113
commit 83b0ce7275

View File

@@ -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;
}