Module: wine Branch: master Commit: e92f66558a8f415cee051d8752438726dbd64bc1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e92f66558a8f415cee051d8752...
Author: James Hawkins truiken@gmail.com Date: Tue Jun 26 16:30:40 2007 -0700
msi: Validate MsiQueryProductCode parameters.
---
dlls/msi/msi.c | 9 ++++++--- dlls/msi/tests/msi.c | 15 +++------------ 2 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index 2042695..05d3bbf 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -764,13 +764,16 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct) UINT rc; INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN; HKEY hkey = 0; - static const WCHAR szWindowsInstaller[] = { - 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0 }; DWORD sz;
+ static const int GUID_LEN = 38; + static const WCHAR szWindowsInstaller[] = { + 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0 + }; + TRACE("%s\n", debugstr_w(szProduct));
- if (!szProduct) + if (!szProduct || !*szProduct || lstrlenW(szProduct) != GUID_LEN) return INSTALLSTATE_INVALIDARG;
rc = MSIREG_OpenUserProductsKey(szProduct,&hkey,FALSE); diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index d905824..06c7276 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -347,24 +347,15 @@ static void test_MsiQueryProductState(void)
/* empty prodcode */ state = MsiQueryProductStateA(""); - todo_wine - { - ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state); - } + ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
/* garbage prodcode */ state = MsiQueryProductStateA("garbage"); - todo_wine - { - ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state); - } + ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
/* guid without brackets */ state = MsiQueryProductStateA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D"); - todo_wine - { - ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state); - } + ok(state == INSTALLSTATE_INVALIDARG, "Expected INSTALLSTATE_INVALIDARG, got %d\n", state);
/* guid with brackets */ state = MsiQueryProductStateA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}");