[1/2] kernel32: Handle memory allocation failure in ReadConsoleA. Resend.
Dmitry Timoshkov
dmitry at baikal.ru
Mon Apr 14 21:20:21 CDT 2014
---
dlls/kernel32/console.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index 67c353b..9d47bf4 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -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);
--
1.9.2
More information about the wine-patches
mailing list