Commit a92fe55c authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

msi: Fix some possible NULL pointer dereferences (Coverity).

parent 13dccd75
......@@ -667,6 +667,9 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
TRACE("%s\n", debugstr_w(szProduct));
if (!szProduct)
return INSTALLSTATE_INVALIDARG;
rc = MSIREG_OpenUserProductsKey(szProduct,&hkey,FALSE);
if (rc != ERROR_SUCCESS)
goto end;
......
......@@ -514,6 +514,9 @@ UINT WINAPI MsiOpenPackageExW(LPCWSTR szPackage, DWORD dwOptions, MSIHANDLE *phP
TRACE("%s %08lx %p\n", debugstr_w(szPackage), dwOptions, phPackage );
if( szPackage == NULL )
return ERROR_INVALID_PARAMETER;
if( dwOptions )
FIXME("dwOptions %08lx not supported\n", dwOptions);
......
......@@ -675,6 +675,9 @@ UINT WINAPI MsiEnumFeaturesW(LPCWSTR szProduct, DWORD index,
TRACE("%s %ld %p %p\n",debugstr_w(szProduct),index,szFeature,szParent);
if( !szProduct )
return ERROR_INVALID_PARAMETER;
r = MSIREG_OpenFeaturesKey(szProduct,&hkeyProduct,FALSE);
if( r != ERROR_SUCCESS )
return ERROR_NO_MORE_ITEMS;
......
......@@ -66,6 +66,21 @@ static void test_usefeature(void)
}
static void test_null(void)
{
MSIHANDLE hpkg;
UINT r;
r = MsiOpenPackageExW(NULL, 0, &hpkg);
ok( r == ERROR_INVALID_PARAMETER,"wrong error");
r = MsiQueryProductStateW(NULL);
ok( r == INSTALLSTATE_INVALIDARG, "wrong return\n");
r = MsiEnumFeaturesW(NULL,0,NULL,NULL);
ok( r == ERROR_INVALID_PARAMETER,"wrong error");
}
START_TEST(msi)
{
HMODULE hmod = GetModuleHandle("msi.dll");
......@@ -73,4 +88,5 @@ START_TEST(msi)
GetProcAddress(hmod, "MsiUseFeatureExA");
test_usefeature();
test_null();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment