mirror of
https://github.com/reactos/reactos.git
synced 2024-11-18 21:13:52 +00:00
[HAL] Fix parser bugs in HalpDebugPciDumpBus (#1895)
- Match subclass properly, don't match third subclass. - Don't match subclass from next class, add ClassEnd boundary. - Use class name if subclass name not available. - Gracefully return "Unknown" if no class name found.
This commit is contained in:
parent
43f03da358
commit
894635bb00
1 changed files with 20 additions and 11 deletions
|
@ -809,7 +809,7 @@ HalpDebugPciDumpBus(IN ULONG i,
|
|||
IN ULONG k,
|
||||
IN PPCI_COMMON_CONFIG PciData)
|
||||
{
|
||||
PCHAR p, ClassName, SubClassName, VendorName, ProductName, SubVendorName;
|
||||
PCHAR p, ClassName, ClassEnd, SubClassName, VendorName, ProductName, SubVendorName;
|
||||
ULONG Length;
|
||||
CHAR LookupString[16] = "";
|
||||
CHAR bSubClassName[64] = "";
|
||||
|
@ -824,19 +824,28 @@ HalpDebugPciDumpBus(IN ULONG i,
|
|||
if (ClassName)
|
||||
{
|
||||
/* Isolate the subclass name */
|
||||
ClassName += 6;
|
||||
sprintf(LookupString, "\t%02x ", PciData->SubClass);
|
||||
ClassName += strlen("C 00 ");
|
||||
ClassEnd = strstr(ClassName, "\nC ");
|
||||
sprintf(LookupString, "\n\t%02x ", PciData->SubClass);
|
||||
SubClassName = strstr(ClassName, LookupString);
|
||||
if (SubClassName)
|
||||
if (ClassEnd && SubClassName > ClassEnd)
|
||||
{
|
||||
/* Copy the subclass into our buffer */
|
||||
SubClassName += 5;
|
||||
p = strpbrk(SubClassName, "\r\n");
|
||||
Length = p - SubClassName;
|
||||
if (Length >= sizeof(bSubClassName)) Length = sizeof(bSubClassName) - 1;
|
||||
strncpy(bSubClassName, SubClassName, Length);
|
||||
bSubClassName[Length] = '\0';
|
||||
SubClassName = NULL;
|
||||
}
|
||||
if (!SubClassName)
|
||||
{
|
||||
SubClassName = ClassName;
|
||||
}
|
||||
else
|
||||
{
|
||||
SubClassName += strlen("\n\t00 ");
|
||||
}
|
||||
/* Copy the subclass into our buffer */
|
||||
p = strpbrk(SubClassName, "\r\n");
|
||||
Length = p - SubClassName;
|
||||
if (Length >= sizeof(bSubClassName)) Length = sizeof(bSubClassName) - 1;
|
||||
strncpy(bSubClassName, SubClassName, Length);
|
||||
bSubClassName[Length] = '\0';
|
||||
}
|
||||
|
||||
/* Isolate the vendor name */
|
||||
|
|
Loading…
Reference in a new issue