[NTOS:KE] Fix buffer overflow when displaying x64 bug checks

This commit is contained in:
Thomas Faber 2022-01-03 10:15:57 -05:00
parent 2a2f8dbebd
commit a4b2c80853
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -611,7 +611,7 @@ KiDisplayBlueScreen(IN ULONG MessageId,
IN PCHAR HardErrMessage OPTIONAL,
IN PCHAR Message)
{
CHAR AnsiName[75];
CHAR AnsiName[107];
/* Check if bootvid is installed */
if (InbvIsBootDriverInstalled())
@ -676,13 +676,14 @@ KiDisplayBlueScreen(IN ULONG MessageId,
KeGetBugMessageText(BUGCHECK_TECH_INFO, NULL);
/* Show the technical Data */
sprintf(AnsiName,
"\r\n\r\n*** STOP: 0x%08lX (0x%p,0x%p,0x%p,0x%p)\r\n\r\n",
(ULONG)KiBugCheckData[0],
(PVOID)KiBugCheckData[1],
(PVOID)KiBugCheckData[2],
(PVOID)KiBugCheckData[3],
(PVOID)KiBugCheckData[4]);
RtlStringCbPrintfA(AnsiName,
sizeof(AnsiName),
"\r\n\r\n*** STOP: 0x%08lX (0x%p,0x%p,0x%p,0x%p)\r\n\r\n",
(ULONG)KiBugCheckData[0],
(PVOID)KiBugCheckData[1],
(PVOID)KiBugCheckData[2],
(PVOID)KiBugCheckData[3],
(PVOID)KiBugCheckData[4]);
InbvDisplayString(AnsiName);
/* Check if we have a driver*/