URLMON: Correctly fix IStream::Read

Thomas Weidenmueller wine-patches at reactsoft.com
Fri Dec 9 08:05:54 CST 2005


Don't dereference a possible NULL pointer...

- Thomas
-------------- next part --------------
Index: dlls/urlmon/umstream.c
===================================================================
RCS file: /home/wine/wine/dlls/urlmon/umstream.c,v
retrieving revision 1.3
diff -u -r1.3 umstream.c
--- dlls/urlmon/umstream.c	9 Dec 2005 12:17:35 -0000	1.3
+++ dlls/urlmon/umstream.c	9 Dec 2005 14:05:23 -0000
@@ -225,7 +225,7 @@
                                       ULONG cb,
                                       ULONG* pcbRead)
 {
-    DWORD dwBytesRead;
+    ULONG dwBytesRead;
     IUMCacheStream *This = (IUMCacheStream *)iface;
 
     TRACE("(%p)->(%p,0x%08lx,%p)\n",This, pv, cb, pcbRead);
@@ -233,7 +233,10 @@
     if ( !pv )
        return STG_E_INVALIDPOINTER;
 
-    if ( ! ReadFile( This->handle, pv, cb, (pcbRead ? pcbRead : &dwBytesRead), NULL ) )
+    if ( !pcbRead)
+        pcbRead = &dwBytesRead;
+
+    if ( ! ReadFile( This->handle, pv, cb, (LPDWORD)pcbRead), NULL ) )
        return S_FALSE;
 
     if (!*pcbRead)


More information about the wine-patches mailing list