Author: akhaldi Date: Fri Jul 15 20:18:20 2016 New Revision: 71947 URL: http://svn.reactos.org/svn/reactos?rev=71947&view=rev Log: [KERNEL32] Check the return buffer for NULL before initializing the unicode string buffer with it. By Peter Hater. CORE-11368
Modified: trunk/reactos/dll/win32/kernel32/client/compname.c Modified: trunk/reactos/dll/win32/kernel32/client/compname.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/compname.c?rev=71947&r1=71946&r2=71947&view=diff ============================================================================== --- trunk/reactos/dll/win32/kernel32/client/compname.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/compname.c [iso-8859-1] Fri Jul 15 20:18:20 2016 @@ -263,8 +263,15 @@ UNICODE_STRING UnicodeString; ANSI_STRING AnsiString; BOOL Result; - PWCHAR TempBuffer = RtlAllocateHeap( RtlGetProcessHeap(), 0, *nSize * sizeof(WCHAR) ); - + PWCHAR TempBuffer; + + if (!lpBuffer) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + TempBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, *nSize * sizeof(WCHAR)); if (!TempBuffer) { SetLastError(ERROR_NOT_ENOUGH_MEMORY);