Pointer checks in oleaut32

Mike Hearn mike at theoretic.com
Mon Feb 24 14:55:05 CST 2003


Hi,

Attached patch ensures both parameters are checked for validity, RhymBox
which uses ATL to embed the IE6 WebBrowser control now gets a bit
further than last time.

License: LGPL only
ChangeLog:
	
- Check both pointers in GetContainingTypeLib

thanks -mike
-------------- next part --------------
Index: dlls/oleaut32//typelib.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.c,v
retrieving revision 1.89
diff -u -r1.89 typelib.c
--- dlls/oleaut32//typelib.c	21 Jan 2003 19:29:33 -0000	1.89
+++ dlls/oleaut32//typelib.c	24 Feb 2003 20:46:57 -0000
@@ -4796,12 +4796,19 @@
         ITypeLib  * *ppTLib, UINT  *pIndex)
 {
     ICOM_THIS( ITypeInfoImpl, iface);
-    if (!pIndex)
-        return E_INVALIDARG;
-    *ppTLib=(LPTYPELIB )(This->pTypeLib);
-    *pIndex=This->index;
-    ITypeLib2_AddRef(*ppTLib);
-    TRACE("(%p) returns (%p) index %d!\n", This, *ppTLib, *pIndex);
+    
+    /* If a pointer is null, we simply ignore it, the ATL in particular passes pIndex as 0 */
+    if (pIndex) {
+      *pIndex=This->index;
+      TRACE("returning pIndex=%d", *pIndex);
+    }
+    
+    if (ppTLib) {
+      *ppTLib=(LPTYPELIB )(This->pTypeLib);
+      ITypeLib2_AddRef(*ppTLib);
+      TRACE("returning ppTLib=%p", *ppTLib);
+    }
+    
     return S_OK;
 }
 


More information about the wine-patches mailing list