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
parent e14d352661
commit fc8f9f4331

View File

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