Author: akhaldi
Date: Sun Apr 26 19:17:51 2015
New Revision: 67446
URL:
http://svn.reactos.org/svn/reactos?rev=67446&view=rev
Log:
[USERENV] Check for invalid parameters in Get{Profiles,UserProfile}Directory{A,W}. Fixes
userenv:userenv test crash.
Modified:
trunk/reactos/dll/win32/userenv/profile.c
Modified: trunk/reactos/dll/win32/userenv/profile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/userenv/profile.…
==============================================================================
--- trunk/reactos/dll/win32/userenv/profile.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/userenv/profile.c [iso-8859-1] Sun Apr 26 19:17:51 2015
@@ -672,6 +672,12 @@
LPWSTR lpBuffer;
BOOL bResult;
+ if (!lpProfileDir || !lpcchSize)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
lpBuffer = GlobalAlloc(GMEM_FIXED,
*lpcchSize * sizeof(WCHAR));
if (lpBuffer == NULL)
@@ -708,6 +714,12 @@
HKEY hKey;
LONG Error;
+ if (!lpcchSize)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
Error = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion\\ProfileList",
0,
@@ -774,6 +786,12 @@
{
LPWSTR lpBuffer;
BOOL bResult;
+
+ if (!lpProfileDir || !lpcchSize)
+ {
+ SetLastError( ERROR_INVALID_PARAMETER );
+ return FALSE;
+ }
lpBuffer = GlobalAlloc(GMEM_FIXED,
*lpcchSize * sizeof(WCHAR));
@@ -814,6 +832,12 @@
DWORD dwLength;
HKEY hKey;
LONG Error;
+
+ if (!lpcchSize)
+ {
+ SetLastError( ERROR_INVALID_PARAMETER );
+ return FALSE;
+ }
if (!GetUserSidStringFromToken(hToken,
&SidString))