ntdll: Validate len in NtQueryVirtualMemory.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45632
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gijs Vermeulen 2019-02-18 15:22:52 +01:00 committed by Alexandre Julliard
parent 9a6fcdf42f
commit d2d52717af
2 changed files with 6 additions and 0 deletions

View File

@ -2005,6 +2005,9 @@ static void test_queryvirtualmemory(void)
/* check error code when addr is higher than working set limit */
status = pNtQueryVirtualMemory(NtCurrentProcess(), (void *)~0, MemoryBasicInformation, &mbi, sizeof(mbi), &readcount);
ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
/* check error code when len is less than MEMORY_BASIC_INFORMATION size */
status = pNtQueryVirtualMemory(NtCurrentProcess(), GetProcessHeap(), MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION) - 1, &readcount);
ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
}
static void test_affinity(void)

View File

@ -2820,6 +2820,9 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
}
}
if (len < sizeof(MEMORY_BASIC_INFORMATION))
return STATUS_INFO_LENGTH_MISMATCH;
if (process != NtCurrentProcess())
{
NTSTATUS status;