msi: Validate the szProduct parameter of MsiSourceListSetInfo.

This commit is contained in:
James Hawkins 2008-02-19 02:08:11 -06:00 committed by Alexandre Julliard
parent 10be16f33a
commit f83d049888
2 changed files with 8 additions and 17 deletions

View File

@ -394,13 +394,14 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
MSIINSTALLCONTEXT dwContext, DWORD dwOptions,
LPCWSTR szProperty, LPCWSTR szValue)
{
WCHAR squished_pc[GUID_SIZE];
HKEY sourcekey;
UINT rc;
TRACE("%s %s %x %x %s %s\n", debugstr_w(szProduct), debugstr_w(szUserSid),
dwContext, dwOptions, debugstr_w(szProperty), debugstr_w(szValue));
if (!szProduct || lstrlenW(szProduct) > 39)
if (!szProduct || !squash_guid(szProduct, squished_pc))
return ERROR_INVALID_PARAMETER;
if (!szProperty)

View File

@ -1398,7 +1398,6 @@ static void test_MsiSourceListSetInfo(void)
LONG res;
UINT r;
create_test_guid(prodcode, prod_squashed);
get_user_sid(&usersid);
@ -1415,33 +1414,24 @@ static void test_MsiSourceListSetInfo(void)
r = MsiSourceListSetInfoA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_NETWORK,
INSTALLPROPERTY_MEDIAPACKAGEPATH, "path");
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 = MsiSourceListSetInfoA("garbage", usersid,
MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_NETWORK,
INSTALLPROPERTY_MEDIAPACKAGEPATH, "path");
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 = MsiSourceListSetInfoA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA",
usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
MSICODE_PRODUCT | MSISOURCETYPE_NETWORK,
INSTALLPROPERTY_MEDIAPACKAGEPATH, "path");
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 = MsiSourceListSetInfoA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}",