mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 20:59:54 +00:00
kernel32: Fix another overflow in GetModuleFileNameExW.
This commit is contained in:
parent
6a19d9f252
commit
fd11023e4b
@ -1255,18 +1255,20 @@ DWORD WINAPI K32GetModuleFileNameExW(HANDLE process, HMODULE module,
|
||||
return 0;
|
||||
|
||||
len = ldr_module.FullDllName.Length / sizeof(WCHAR);
|
||||
if (size <= len)
|
||||
{
|
||||
len = size;
|
||||
size--;
|
||||
}
|
||||
|
||||
if (!ReadProcessMemory(process, ldr_module.FullDllName.Buffer,
|
||||
file_name, size * sizeof(WCHAR), NULL))
|
||||
file_name, min( len, size ) * sizeof(WCHAR), NULL))
|
||||
return 0;
|
||||
|
||||
file_name[size] = 0;
|
||||
return len;
|
||||
if (len < size)
|
||||
{
|
||||
file_name[len] = 0;
|
||||
return len;
|
||||
}
|
||||
else
|
||||
{
|
||||
file_name[size - 1] = 0;
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user