Module: wine Branch: master Commit: 5d2f80235992748d10d8ba7519810fef8fca9055 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5d2f80235992748d10d8ba7519...
Author: Rob Shearman rob@codeweavers.com Date: Tue Nov 13 18:58:34 2007 +0000
ole32: Validate the parameters to DataCache_Cache.
---
dlls/ole32/datacache.c | 4 ++++ dlls/ole32/tests/ole2.c | 6 ++++++ 2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c index 1b43eb5..18cd5c2 100644 --- a/dlls/ole32/datacache.c +++ b/dlls/ole32/datacache.c @@ -1971,6 +1971,10 @@ static HRESULT WINAPI DataCache_Cache( HRESULT hr;
TRACE("(%p, 0x%x, %p)\n", pformatetc, advf, pdwConnection); + + if (!pformatetc || !pdwConnection) + return E_INVALIDARG; + TRACE("pformatetc = %s\n", debugstr_formatetc(pformatetc));
*pdwConnection = 0; diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c index bcac1b4..88b58e7 100644 --- a/dlls/ole32/tests/ole2.c +++ b/dlls/ole32/tests/ole2.c @@ -1128,6 +1128,12 @@ static void test_data_cache(void) hr = IOleCache_Uncache(pOleCache, 0xdeadbeef); ok(hr == OLE_E_NOCONNECTION, "IOleCache_Uncache with invalid value should return OLE_E_NOCONNECTION instead of 0x%x\n", hr);
+ hr = IOleCache_Cache(pOleCache, NULL, 0, &dwConnection); + ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL fmtetc should have returned E_INVALIDARG instead of 0x%08x\n", hr); + + hr = IOleCache_Cache(pOleCache, NULL, 0, NULL); + ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL pdwConnection should have returned E_INVALIDARG instead of 0x%08x\n", hr); + for (fmtetc.cfFormat = CF_TEXT; fmtetc.cfFormat < CF_MAX; fmtetc.cfFormat++) { int i;