From 7782e8188795ddc4cbdb51d81e1d5aa7200f6a33 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 23 Sep 2010 11:48:04 +0200 Subject: [PATCH] wininet: Check URLCache_LocalFileNameToPathW() return values in CreateUrlCacheEntryW(). It would be unfortunate if a long file name would cause us to open a file based on mostly uninitialized data and write the contents of some random webpage into it. --- dlls/wininet/urlcache.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/wininet/urlcache.c b/dlls/wininet/urlcache.c index 2fe488a029f..a220e330399 100644 --- a/dlls/wininet/urlcache.c +++ b/dlls/wininet/urlcache.c @@ -2330,7 +2330,13 @@ BOOL WINAPI CreateUrlCacheEntryW( CacheDir = (BYTE)(rand() % pHeader->DirectoryCount); lBufferSize = MAX_PATH * sizeof(WCHAR); - URLCache_LocalFileNameToPathW(pContainer, pHeader, szFile, CacheDir, lpszFileName, &lBufferSize); + if (!URLCache_LocalFileNameToPathW(pContainer, pHeader, szFile, CacheDir, lpszFileName, &lBufferSize)) + { + WARN("Failed to get full path for filename %s, needed %u bytes.\n", + debugstr_a(szFile), lBufferSize); + URLCacheContainer_UnlockIndex(pContainer, pHeader); + return FALSE; + } URLCacheContainer_UnlockIndex(pContainer, pHeader);