From 798429f9caa3b235937cf8a19fd91e35d15eeb89 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Mon, 5 Nov 2007 04:26:34 -0500 Subject: [PATCH] msi: Validate the product code. --- dlls/msi/source.c | 3 ++- dlls/msi/tests/source.c | 15 +++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/dlls/msi/source.c b/dlls/msi/source.c index 11140c48bf9..bdd32444b79 100644 --- a/dlls/msi/source.c +++ b/dlls/msi/source.c @@ -589,11 +589,12 @@ UINT WINAPI MsiSourceListAddSourceExW( LPCWSTR szProduct, LPCWSTR szUserSid, HKEY typekey; UINT rc; media_info source_struct; + WCHAR squished_pc[GUID_SIZE]; TRACE("%s %s %x %x %s %i\n", debugstr_w(szProduct), debugstr_w(szUserSid), dwContext, dwOptions, debugstr_w(szSource), dwIndex); - if (!szProduct) + if (!szProduct || !squash_guid(szProduct, squished_pc)) return ERROR_INVALID_PARAMETER; if (!szSource) diff --git a/dlls/msi/tests/source.c b/dlls/msi/tests/source.c index aa58c362391..140da845b6c 100644 --- a/dlls/msi/tests/source.c +++ b/dlls/msi/tests/source.c @@ -365,27 +365,18 @@ static void test_MsiSourceListAddSourceEx(void) /* empty szProductCodeOrPatchCode */ r = pMsiSourceListAddSourceExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); - todo_wine - { - ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - } + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* garbage szProductCodeOrPatchCode */ r = pMsiSourceListAddSourceExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); - todo_wine - { - ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - } + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid without brackets */ r = pMsiSourceListAddSourceExA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); - todo_wine - { - ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - } + ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); /* guid with brackets */ r = pMsiSourceListAddSourceExA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid, -- 2.11.4.GIT