[KERNEL32] Check the return buffer for NULL before initializing the unicode string...
authorAmine Khaldi <amine.khaldi@reactos.org>
Fri, 15 Jul 2016 20:18:20 +0000 (20:18 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Fri, 15 Jul 2016 20:18:20 +0000 (20:18 +0000)
svn path=/trunk/; revision=71947

reactos/dll/win32/kernel32/client/compname.c

index 407850a..06c11b6 100644 (file)
@@ -263,8 +263,15 @@ GetComputerNameExA(COMPUTER_NAME_FORMAT NameType,
     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);