[PATCH 3/5] shell32: Avoid crash on NULL pointer

Detlef Riekenberg wine.dev at web.de
Sun Jan 15 17:06:14 CST 2012


---
 dlls/shell32/assoc.c       |    3 +++
 dlls/shell32/tests/assoc.c |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c
index 0e6b6ba..942e796 100644
--- a/dlls/shell32/assoc.c
+++ b/dlls/shell32/assoc.c
@@ -84,6 +84,9 @@ static HRESULT WINAPI IQueryAssociations_fnQueryInterface(
 
   TRACE("(%p,%s,%p)\n",This, debugstr_guid(riid), ppvObj);
 
+  if (ppvObj == NULL)
+      return E_POINTER;
+
   *ppvObj = NULL;
 
   if (IsEqualIID(riid, &IID_IUnknown) ||
diff --git a/dlls/shell32/tests/assoc.c b/dlls/shell32/tests/assoc.c
index 00d04ff..8d09ec2 100644
--- a/dlls/shell32/tests/assoc.c
+++ b/dlls/shell32/tests/assoc.c
@@ -54,6 +54,9 @@ static void test_IQueryAssociations_QueryInterface(void)
         IUnknown_Release(unk);
     }
 
+    hr = IUnknown_QueryInterface(qa, &IID_IUnknown, NULL);
+    ok(hr == E_POINTER, "got 0x%x (expected E_POINTER)\n", hr);
+
     IQueryAssociations_Release(qa);
 }
 
-- 
1.7.5.4




More information about the wine-patches mailing list