wininet: Prevent use after free in logging.

Make logs which show values that are unmapped by cache_container_unlock_index()
go before it's called.

Signed-off-by: Jan Sikorski <jsikorski@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jan Sikorski 2020-10-30 12:13:23 +01:00 committed by Alexandre Julliard
parent b7f14a97bd
commit bcdb58cc79

View file

@ -1808,9 +1808,9 @@ static BOOL urlcache_get_entry_info(const char *url, void *entry_info,
url_entry = (const entry_url*)((LPBYTE)header + hash_entry->offset);
if(url_entry->header.signature != URL_SIGNATURE) {
cache_container_unlock_index(container, header);
FIXME("Trying to retrieve entry of unknown format %s\n",
debugstr_an((LPCSTR)&url_entry->header.signature, sizeof(DWORD)));
cache_container_unlock_index(container, header);
SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE;
}
@ -2041,8 +2041,8 @@ BOOL WINAPI SetUrlCacheEntryInfoA(LPCSTR lpszUrlName,
pEntry = (entry_header*)((LPBYTE)pHeader + pHashEntry->offset);
if (pEntry->signature != URL_SIGNATURE)
{
cache_container_unlock_index(pContainer, pHeader);
FIXME("Trying to retrieve entry of unknown format %s\n", debugstr_an((LPSTR)&pEntry->signature, sizeof(DWORD)));
cache_container_unlock_index(pContainer, pHeader);
SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE;
}
@ -2111,9 +2111,9 @@ static BOOL urlcache_entry_get_file(const char *url, void *entry_info, DWORD *si
url_entry = (entry_url*)((LPBYTE)header + hash_entry->offset);
if(url_entry->header.signature != URL_SIGNATURE) {
cache_container_unlock_index(container, header);
FIXME("Trying to retrieve entry of unknown format %s\n",
debugstr_an((LPSTR)&url_entry->header.signature, sizeof(DWORD)));
cache_container_unlock_index(container, header);
SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE;
}
@ -4004,9 +4004,9 @@ BOOL WINAPI IsUrlCacheEntryExpiredA(LPCSTR url, DWORD dwFlags, FILETIME* pftLast
pEntry = (const entry_header*)((LPBYTE)pHeader + pHashEntry->offset);
if (pEntry->signature != URL_SIGNATURE)
{
FIXME("Trying to retrieve entry of unknown format %s\n", debugstr_an((LPCSTR)&pEntry->signature, sizeof(DWORD)));
cache_container_unlock_index(pContainer, pHeader);
memset(pftLastModified, 0, sizeof(*pftLastModified));
FIXME("Trying to retrieve entry of unknown format %s\n", debugstr_an((LPCSTR)&pEntry->signature, sizeof(DWORD)));
return TRUE;
}