msi: Fix NULL dereference in MsiQueryComponentStateW (Coverity).
This commit is contained in:
parent
f34e733c2c
commit
9598a50916
|
@ -1553,7 +1553,7 @@ UINT WINAPI MsiQueryComponentStateW(LPCWSTR szProductCode,
|
||||||
TRACE("(%s, %s, %d, %s, %p)\n", debugstr_w(szProductCode),
|
TRACE("(%s, %s, %d, %s, %p)\n", debugstr_w(szProductCode),
|
||||||
debugstr_w(szUserSid), dwContext, debugstr_w(szComponent), pdwState);
|
debugstr_w(szUserSid), dwContext, debugstr_w(szComponent), pdwState);
|
||||||
|
|
||||||
if (!pdwState)
|
if (!pdwState || !szComponent)
|
||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
if (!szProductCode || !*szProductCode || lstrlenW(szProductCode) != GUID_SIZE - 1)
|
if (!szProductCode || !*szProductCode || lstrlenW(szProductCode) != GUID_SIZE - 1)
|
||||||
|
|
|
@ -1278,6 +1278,12 @@ static void test_MsiQueryComponentState(void)
|
||||||
ok(state == INSTALLSTATE_NOTUSED || state == INSTALLSTATE_LOCAL,
|
ok(state == INSTALLSTATE_NOTUSED || state == INSTALLSTATE_LOCAL,
|
||||||
"Expected INSTALLSTATE_NOTUSED or INSTALLSTATE_LOCAL, got %d\n", state);
|
"Expected INSTALLSTATE_NOTUSED or INSTALLSTATE_LOCAL, got %d\n", state);
|
||||||
|
|
||||||
|
/* NULL component, product exists */
|
||||||
|
state = MAGIC_ERROR;
|
||||||
|
r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, NULL, &state);
|
||||||
|
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||||
|
ok(state == MAGIC_ERROR, "Expected state not changed, got %d\n", state);
|
||||||
|
|
||||||
res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"hi", 2);
|
res = RegSetValueExA(compkey, prod_squashed, 0, REG_SZ, (const BYTE *)"hi", 2);
|
||||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue