[NTOSKRNL] In IopQueryNameInternal() don't copy name if it's not valid

This commit is contained in:
Pierre Schweitzer 2018-10-03 13:50:16 +02:00
parent 4a7e89770e
commit 46bda8a4c6
No known key found for this signature in database
GPG Key ID: 7545556C3D585B0B

View File

@ -2004,6 +2004,14 @@ IopQueryNameInternal(IN PVOID ObjectBody,
(ULONG_PTR)ObjectNameInfo +
LocalFileInfo->FileNameLength);
/* Don't copy the name if it's not valid */
if (LocalFileInfo->FileName[0] != OBJ_NAME_PATH_SEPARATOR)
{
/* Free the allocated buffer and return failure */
ExFreePoolWithTag(LocalInfo, TAG_IO);
return STATUS_OBJECT_PATH_INVALID;
}
/* Write the Name and null-terminate it */
RtlCopyMemory(p, LocalFileInfo->FileName, FileLength);
p += (FileLength / sizeof(WCHAR));