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.
This commit is contained in:
Henri Verbeet 2010-09-23 11:48:04 +02:00 committed by Alexandre Julliard
parent 578df29b9f
commit 7782e81887
1 changed files with 7 additions and 1 deletions

View File

@ -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);