Author: dreimer
Date: Sun Jun 16 22:15:28 2013
New Revision: 59244
URL:
http://svn.reactos.org/svn/reactos?rev=59244&view=rev
Log:
advapi32: avicap32: fix missing allocation checks, and incorrect free calls by andygui
CORE-7197 #resolve #comment Committed in revision r59243, thanks for help
Modified:
trunk/reactos/dll/win32/advapi32/misc/logon.c
trunk/reactos/dll/win32/advapi32/sec/sid.c
trunk/reactos/dll/win32/avicap32/avicap32.c
Modified: trunk/reactos/dll/win32/advapi32/misc/logon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/misc/lo…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/misc/logon.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/misc/logon.c [iso-8859-1] Sun Jun 16 22:15:28 2013
@@ -650,7 +650,7 @@
/* Get the user SID from the registry */
if (!GetUserSid (lpszUsername, &UserSid))
{
- ERR("SamGetUserSid() failed\n");
+ ERR("GetUserSid() failed\n");
return FALSE;
}
Modified: trunk/reactos/dll/win32/advapi32/sec/sid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/sid…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/sec/sid.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/sec/sid.c [iso-8859-1] Sun Jun 16 22:15:28 2013
@@ -678,7 +678,7 @@
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);
return FALSE;
}
@@ -698,6 +698,9 @@
return FALSE;
wstr = wptr = LocalAlloc(0, (len + 1)*sizeof(WCHAR));
+ if (wstr == NULL)
+ return FALSE;
+
if (SecurityInformation & OWNER_SECURITY_INFORMATION)
if (!DumpOwner(SecurityDescriptor, &wptr, NULL))
return FALSE;
@@ -740,6 +743,12 @@
lenA = WideCharToMultiByte(CP_ACP, 0, wstr, len, NULL, 0, NULL, NULL);
*OutputString = HeapAlloc(GetProcessHeap(), 0, lenA);
+ if (*OutputString == NULL)
+ {
+ LocalFree(wstr);
+ *OutputLen = 0;
+ return FALSE;
+ }
WideCharToMultiByte(CP_ACP, 0, wstr, len, *OutputString, lenA, NULL, NULL);
LocalFree(wstr);
@@ -1786,6 +1795,8 @@
{
UINT len = MultiByteToWideChar(CP_ACP, 0, StringSid, -1, NULL, 0);
LPWSTR wStringSid = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ if (wStringSid == NULL)
+ return FALSE;
MultiByteToWideChar(CP_ACP, 0, StringSid, - 1, wStringSid, len);
bRetVal = ConvertStringSidToSidW(wStringSid, sid);
HeapFree(GetProcessHeap(), 0, wStringSid);
Modified: trunk/reactos/dll/win32/avicap32/avicap32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avicap32/avicap3…
==============================================================================
--- trunk/reactos/dll/win32/avicap32/avicap32.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/avicap32/avicap32.c [iso-8859-1] Sun Jun 16 22:15:28 2013
@@ -218,21 +218,24 @@
if (dwInfoSize)
{
Version = HeapAlloc(GetProcessHeap(), 0, dwInfoSize);
-
- GetFileVersionInfo(szFileName, 0, dwInfoSize, Version);
-
- if (VerQueryValueW(Version, L"\\", &Ms,
&Ls))
+
+ if (Version != NULL)
{
- 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);
+ GetFileVersionInfo(szFileName, 0, dwInfoSize, Version);
+
+ 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);
}
}