Author: gschneider Date: Tue Aug 18 15:47:02 2009 New Revision: 42765
URL: http://svn.reactos.org/svn/reactos?rev=42765&view=rev Log: - GetConsoleAliasW: Check for invalid target buffer, failed memory allocation + set last error
Modified: trunk/reactos/dll/win32/kernel32/misc/console.c
Modified: trunk/reactos/dll/win32/kernel32/misc/console.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/con... ============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/console.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/console.c [iso-8859-1] Tue Aug 18 15:47:02 2009 @@ -352,6 +352,12 @@
DPRINT("GetConsoleAliasW entered lpSource %S lpExeName %S\n", lpSource, lpExeName);
+ if (lpTargetBuffer == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + CsrRequest = MAKE_CSR_API(GET_CONSOLE_ALIAS, CSR_CONSOLE);
ExeLength = wcslen(lpExeName) + 1; @@ -361,11 +367,17 @@
RequestLength = Size + sizeof(CSR_API_MESSAGE); Request = RtlAllocateHeap(GetProcessHeap(), 0, RequestLength); + if (Request == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + }
CaptureBuffer = CsrAllocateCaptureBuffer(1, TargetBufferLength); if (!CaptureBuffer) { RtlFreeHeap(GetProcessHeap(), 0, Request); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); return 0; }