mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 15:33:07 +00:00
advapi32: avicap32: fix missing allocation checks, and incorrect free calls by andygui
CORE-7197 #resolve #comment Committed in revision r59243, thanks for help svn path=/trunk/; revision=59244
This commit is contained in:
parent
30262ea0ce
commit
d67db490fb
3 changed files with 28 additions and 14 deletions
|
@ -650,7 +650,7 @@ LogonUserW(LPWSTR lpszUsername,
|
||||||
/* Get the user SID from the registry */
|
/* Get the user SID from the registry */
|
||||||
if (!GetUserSid (lpszUsername, &UserSid))
|
if (!GetUserSid (lpszUsername, &UserSid))
|
||||||
{
|
{
|
||||||
ERR("SamGetUserSid() failed\n");
|
ERR("GetUserSid() failed\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -678,7 +678,7 @@ ConvertSecurityDescriptorToStringSecurityDescriptorW(PSECURITY_DESCRIPTOR Securi
|
||||||
|
|
||||||
if (SDRevision != SDDL_REVISION_1)
|
if (SDRevision != SDDL_REVISION_1)
|
||||||
{
|
{
|
||||||
ERR("Pogram requested unknown SDDL revision %d\n", SDRevision);
|
ERR("Program requested unknown SDDL revision %d\n", SDRevision);
|
||||||
SetLastError(ERROR_UNKNOWN_REVISION);
|
SetLastError(ERROR_UNKNOWN_REVISION);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -698,6 +698,9 @@ ConvertSecurityDescriptorToStringSecurityDescriptorW(PSECURITY_DESCRIPTOR Securi
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
wstr = wptr = LocalAlloc(0, (len + 1)*sizeof(WCHAR));
|
wstr = wptr = LocalAlloc(0, (len + 1)*sizeof(WCHAR));
|
||||||
|
if (wstr == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (SecurityInformation & OWNER_SECURITY_INFORMATION)
|
if (SecurityInformation & OWNER_SECURITY_INFORMATION)
|
||||||
if (!DumpOwner(SecurityDescriptor, &wptr, NULL))
|
if (!DumpOwner(SecurityDescriptor, &wptr, NULL))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -740,6 +743,12 @@ ConvertSecurityDescriptorToStringSecurityDescriptorA(PSECURITY_DESCRIPTOR Securi
|
||||||
|
|
||||||
lenA = WideCharToMultiByte(CP_ACP, 0, wstr, len, NULL, 0, NULL, NULL);
|
lenA = WideCharToMultiByte(CP_ACP, 0, wstr, len, NULL, 0, NULL, NULL);
|
||||||
*OutputString = HeapAlloc(GetProcessHeap(), 0, lenA);
|
*OutputString = HeapAlloc(GetProcessHeap(), 0, lenA);
|
||||||
|
if (*OutputString == NULL)
|
||||||
|
{
|
||||||
|
LocalFree(wstr);
|
||||||
|
*OutputLen = 0;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
WideCharToMultiByte(CP_ACP, 0, wstr, len, *OutputString, lenA, NULL, NULL);
|
WideCharToMultiByte(CP_ACP, 0, wstr, len, *OutputString, lenA, NULL, NULL);
|
||||||
LocalFree(wstr);
|
LocalFree(wstr);
|
||||||
|
|
||||||
|
@ -1786,6 +1795,8 @@ ConvertStringSidToSidA(IN LPCSTR StringSid,
|
||||||
{
|
{
|
||||||
UINT len = MultiByteToWideChar(CP_ACP, 0, StringSid, -1, NULL, 0);
|
UINT len = MultiByteToWideChar(CP_ACP, 0, StringSid, -1, NULL, 0);
|
||||||
LPWSTR wStringSid = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
LPWSTR wStringSid = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||||
|
if (wStringSid == NULL)
|
||||||
|
return FALSE;
|
||||||
MultiByteToWideChar(CP_ACP, 0, StringSid, - 1, wStringSid, len);
|
MultiByteToWideChar(CP_ACP, 0, StringSid, - 1, wStringSid, len);
|
||||||
bRetVal = ConvertStringSidToSidW(wStringSid, sid);
|
bRetVal = ConvertStringSidToSidW(wStringSid, sid);
|
||||||
HeapFree(GetProcessHeap(), 0, wStringSid);
|
HeapFree(GetProcessHeap(), 0, wStringSid);
|
||||||
|
|
|
@ -218,21 +218,24 @@ capGetDriverDescriptionW(WORD wDriverIndex,
|
||||||
if (dwInfoSize)
|
if (dwInfoSize)
|
||||||
{
|
{
|
||||||
Version = HeapAlloc(GetProcessHeap(), 0, dwInfoSize);
|
Version = HeapAlloc(GetProcessHeap(), 0, dwInfoSize);
|
||||||
|
|
||||||
GetFileVersionInfo(szFileName, 0, dwInfoSize, Version);
|
if (Version != NULL)
|
||||||
|
|
||||||
if (VerQueryValueW(Version, L"\\", &Ms, &Ls))
|
|
||||||
{
|
{
|
||||||
memmove(&FileInfo, Ms, Ls);
|
GetFileVersionInfo(szFileName, 0, dwInfoSize, Version);
|
||||||
swprintf(szVersion, L"Version: %d.%d.%d.%d",
|
|
||||||
HIWORD(FileInfo.dwFileVersionMS),
|
|
||||||
LOWORD(FileInfo.dwFileVersionMS),
|
|
||||||
HIWORD(FileInfo.dwFileVersionLS),
|
|
||||||
LOWORD(FileInfo.dwFileVersionLS));
|
|
||||||
|
|
||||||
lstrcpynW(lpszVer, szVersion, cbVer);
|
if (VerQueryValueW(Version, L"\\", &Ms, &Ls))
|
||||||
|
{
|
||||||
|
memmove(&FileInfo, Ms, Ls);
|
||||||
|
swprintf(szVersion, L"Version: %d.%d.%d.%d",
|
||||||
|
HIWORD(FileInfo.dwFileVersionMS),
|
||||||
|
LOWORD(FileInfo.dwFileVersionMS),
|
||||||
|
HIWORD(FileInfo.dwFileVersionLS),
|
||||||
|
LOWORD(FileInfo.dwFileVersionLS));
|
||||||
|
|
||||||
|
lstrcpynW(lpszVer, szVersion, cbVer);
|
||||||
|
}
|
||||||
|
HeapFree(GetProcessHeap(), 0, Version);
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, Version);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue