kernel32: Limit the environment variable size to 32767 in GetEnvironmentVariable.

This commit is contained in:
Bruno Jesus 2014-05-30 21:59:08 -03:00 committed by Alexandre Julliard
parent b6d0df6a31
commit 515b8bebb6

View file

@ -176,6 +176,8 @@ DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size )
return 0; return 0;
} }
/* limit the size to sane values */
size = min(size, 32767);
if (!(valueW = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR)))) if (!(valueW = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR))))
return 0; return 0;