msi: Avoid a null pointer dereference.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2017-07-20 23:43:11 -05:00 committed by Alexandre Julliard
parent e76b42c096
commit b4c39f4e7c
2 changed files with 11 additions and 0 deletions

View File

@ -778,6 +778,11 @@ static UINT MSI_DatabaseImport(MSIDATABASE *db, LPCWSTR folder, LPCWSTR file)
lstrcatW( path, file );
data = msi_read_text_archive( path, &len );
if (!data)
{
msi_free(path);
return ERROR_FUNCTION_FAILED;
}
ptr = data;
msi_parse_line( &ptr, &columns, &num_columns, &len );

View File

@ -2369,6 +2369,12 @@ static void test_msiimport(void)
r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = MsiDatabaseImportA(hdb, CURR_DIR, NULL);
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
r = MsiDatabaseImportA(hdb, CURR_DIR, "nonexistent");
ok(r == ERROR_FUNCTION_FAILED, "Expected ERROR_FUNCTION_FAILED, got %d\n", r);
r = add_table_to_db(hdb, test_data);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);