Commit 5e62686a authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Handle a NULL and empty szPackagePath in MsiInstallProduct (Coverity 181).

parent fb8db0ac
......@@ -231,6 +231,12 @@ UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine)
TRACE("%s %s\n",debugstr_w(szPackagePath), debugstr_w(szCommandLine));
if (!szPackagePath)
return ERROR_INVALID_PARAMETER;
if (!*szPackagePath)
return ERROR_PATH_NOT_FOUND;
r = MSI_OpenPackageW( szPackagePath, &package );
if (r == ERROR_SUCCESS)
{
......
......@@ -1721,6 +1721,21 @@ static void test_MsiInstallProduct(void)
return;
}
/* szPackagePath is NULL */
r = MsiInstallProductA(NULL, "INSTALL=ALL");
ok(r == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
/* both szPackagePath and szCommandLine are NULL */
r = MsiInstallProductA(NULL, NULL);
ok(r == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
/* szPackagePath is empty */
r = MsiInstallProductA("", "INSTALL=ALL");
ok(r == ERROR_PATH_NOT_FOUND,
"Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
create_test_files();
create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
......
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