Author: tkreuzer
Date: Sun Dec 27 17:55:14 2015
New Revision: 70441
URL:
http://svn.reactos.org/svn/reactos?rev=70441&view=rev
Log:
[SETUPAPI]
Fix invalid use of wcslen with NULL pointer. Should fix crash in
setupapi_winetest:install.
Modified:
trunk/reactos/dll/win32/setupapi/install.c
Modified: trunk/reactos/dll/win32/setupapi/install.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/install…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/install.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/install.c [iso-8859-1] Sun Dec 27 17:55:14 2015
@@ -1079,7 +1079,9 @@
hr = IShellLinkW_QueryInterface(psl, &IID_IPersistFile,
(LPVOID*)&ppf);
if (SUCCEEDED(hr))
{
- Required = (MAX_PATH + wcslen(LinkSubDir) + 1 + wcslen(LinkName)) *
sizeof(WCHAR);
+ Required = (MAX_PATH + 1 +
+ ((LinkSubDir != NULL) ? wcslen(LinkSubDir) : 0) +
+ ((LinkName != NULL) ? wcslen(LinkName) : 0)) * sizeof(WCHAR);
FullLinkName = MyMalloc(Required);
if (!FullLinkName)
hr = E_OUTOFMEMORY;
@@ -1812,7 +1814,7 @@
if (!GetLineText(hInf, ServiceSection, ServiceBinaryKey, &ServiceBinary))
{
- SetLastError( ERROR_BAD_SERVICE_INSTALLSECT );
+ SetLastError( ERROR_BAD_SERVICE_INSTALLSECT );
goto cleanup;
}