Commit 7782e818 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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.
parent 578df29b
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment