From 97f52680eff18d357e7d366d7774a92eca617edf Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 27 Dec 2015 17:55:14 +0000 Subject: [PATCH] [SETUPAPI] Fix invalid use of wcslen with NULL pointer. Should fix crash in setupapi_winetest:install. svn path=/trunk/; revision=70441 --- reactos/dll/win32/setupapi/install.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/setupapi/install.c b/reactos/dll/win32/setupapi/install.c index 28f0f377f42..bfa67670325 100644 --- a/reactos/dll/win32/setupapi/install.c +++ b/reactos/dll/win32/setupapi/install.c @@ -1079,7 +1079,9 @@ profile_items_callback( 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 @@ static BOOL InstallOneService( if (!GetLineText(hInf, ServiceSection, ServiceBinaryKey, &ServiceBinary)) { - SetLastError( ERROR_BAD_SERVICE_INSTALLSECT ); + SetLastError( ERROR_BAD_SERVICE_INSTALLSECT ); goto cleanup; } -- 2.17.1