Dmitry Timoshkov : kernel32: Handle memory allocation failure in ReadConsoleA.

Alexandre Julliard julliard at winehq.org
Tue Apr 15 14:50:32 CDT 2014


Module: wine
Branch: master
Commit: 2451d263de91bbde461a64d8627c7159bb4dc3c9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2451d263de91bbde461a64d8627c7159bb4dc3c9

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Tue Apr 15 11:20:21 2014 +0900

kernel32: Handle memory allocation failure in ReadConsoleA.

---

 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);
 




More information about the wine-cvs mailing list