From 229e024a53b12b152dc983bac4fd3f9389ae4b08 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Fri, 15 Feb 2008 10:09:25 +0000 Subject: [PATCH] urlmon: Check the return value of ReadFile and return INET_E_DOWNLOAD_FAILURE is it fails. Initialise *pcbRead to zero, if the parameter is not NULL. --- dlls/urlmon/file.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/urlmon/file.c b/dlls/urlmon/file.c index 41ee6176052..91aca2c780c 100644 --- a/dlls/urlmon/file.c +++ b/dlls/urlmon/file.c @@ -229,10 +229,14 @@ static HRESULT WINAPI FileProtocol_Read(IInternetProtocol *iface, void *pv, TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); + if (pcbRead) + *pcbRead = 0; + if(!This->file) return INET_E_DATA_NOT_AVAILABLE; - ReadFile(This->file, pv, cb, &read, NULL); + if (!ReadFile(This->file, pv, cb, &read, NULL)) + return INET_E_DOWNLOAD_FAILURE; if(pcbRead) *pcbRead = read;