Signed-off-by: Sven Baars sven.wine@gmail.com ---
v2: Added NULL checks to PropVariantCopy instead.
dlls/ole32/ole2.c | 3 +++ dlls/ole32/tests/propvariant.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+)
diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c index 2de9edbb80..b3f0d1f9bf 100644 --- a/dlls/ole32/ole2.c +++ b/dlls/ole32/ole2.c @@ -2928,6 +2928,9 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, /* [out] */ ULONG len; HRESULT hr;
+ if (!pvarDest || !pvarSrc) + return E_INVALIDARG; + TRACE("(%p, %p vt %04x)\n", pvarDest, pvarSrc, pvarSrc->vt);
hr = PROPVARIANT_ValidateType(pvarSrc->vt); diff --git a/dlls/ole32/tests/propvariant.c b/dlls/ole32/tests/propvariant.c index 97c4eec4ca..8d74391110 100644 --- a/dlls/ole32/tests/propvariant.c +++ b/dlls/ole32/tests/propvariant.c @@ -306,6 +306,20 @@ static void test_copy(void) PROPVARIANT propvarDst; HRESULT hr;
+ propvarSrc.vt = VT_ILLEGAL; + hr = PropVariantCopy(&propvarDst, &propvarSrc); + ok(hr == DISP_E_BADVARTYPE, "got 0x%08x\n", hr); + + hr = PropVariantCopy(NULL, &propvarSrc); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + propvarSrc.vt = VT_EMPTY; + hr = PropVariantCopy(NULL, &propvarSrc); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = PropVariantCopy(&propvarDst, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + propvarSrc.vt = VT_BSTR; U(propvarSrc).bstrVal = SysAllocString(wszTestString);