Commit 2451d263 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

kernel32: Handle memory allocation failure in ReadConsoleA.

parent 00ff2ed8
......@@ -1607,6 +1607,12 @@ BOOL WINAPI ReadConsoleA(HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfC
DWORD ncr = 0;
BOOL ret;
if (!ptr)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
if ((ret = ReadConsoleW(hConsoleInput, ptr, nNumberOfCharsToRead, &ncr, NULL)))
ncr = WideCharToMultiByte(GetConsoleCP(), 0, ptr, ncr, lpBuffer, nNumberOfCharsToRead, NULL, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment