mirror of
https://github.com/reactos/reactos.git
synced 2024-07-03 19:24:20 +00:00
[USERENV] Check for invalid parameters in Get{Profiles,UserProfile}Directory{A,W}. Fixes userenv:userenv test crash.
svn path=/trunk/; revision=67446
This commit is contained in:
parent
fb31661620
commit
3f777318ec
|
@ -672,6 +672,12 @@ GetProfilesDirectoryA(LPSTR lpProfileDir,
|
|||
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 @@ GetProfilesDirectoryW(LPWSTR lpProfilesDir,
|
|||
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,
|
||||
|
@ -775,6 +787,12 @@ GetUserProfileDirectoryA(HANDLE hToken,
|
|||
LPWSTR lpBuffer;
|
||||
BOOL bResult;
|
||||
|
||||
if (!lpProfileDir || !lpcchSize)
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lpBuffer = GlobalAlloc(GMEM_FIXED,
|
||||
*lpcchSize * sizeof(WCHAR));
|
||||
if (lpBuffer == NULL)
|
||||
|
@ -815,6 +833,12 @@ GetUserProfileDirectoryW(HANDLE hToken,
|
|||
HKEY hKey;
|
||||
LONG Error;
|
||||
|
||||
if (!lpcchSize)
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!GetUserSidStringFromToken(hToken,
|
||||
&SidString))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue