Module: wine Branch: refs/heads/master Commit: ac459e7ea0592feacc67e322d40cc835a805a99f URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=ac459e7ea0592feacc67e322...
Author: Thomas Weidenmueller wine-patches@reactsoft.com Date: Mon Dec 12 11:49:29 2005 +0100
urlmon: Correctly fix IStream::Read. Don't dereference a possible NULL pointer.
---
dlls/urlmon/umstream.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/urlmon/umstream.c b/dlls/urlmon/umstream.c index 720c8ba..36909b6 100644 --- a/dlls/urlmon/umstream.c +++ b/dlls/urlmon/umstream.c @@ -225,7 +225,7 @@ static HRESULT WINAPI IStream_fnRead (IS 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 @@ static HRESULT WINAPI IStream_fnRead (IS 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)