Commit bcdb58cc authored by Jan Sikorski's avatar Jan Sikorski Committed by Alexandre Julliard

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: 's avatarJan Sikorski <jsikorski@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b7f14a97
...@@ -1808,9 +1808,9 @@ static BOOL urlcache_get_entry_info(const char *url, void *entry_info, ...@@ -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); url_entry = (const entry_url*)((LPBYTE)header + hash_entry->offset);
if(url_entry->header.signature != URL_SIGNATURE) { if(url_entry->header.signature != URL_SIGNATURE) {
cache_container_unlock_index(container, header);
FIXME("Trying to retrieve entry of unknown format %s\n", FIXME("Trying to retrieve entry of unknown format %s\n",
debugstr_an((LPCSTR)&url_entry->header.signature, sizeof(DWORD))); debugstr_an((LPCSTR)&url_entry->header.signature, sizeof(DWORD)));
cache_container_unlock_index(container, header);
SetLastError(ERROR_FILE_NOT_FOUND); SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE; return FALSE;
} }
...@@ -2041,8 +2041,8 @@ BOOL WINAPI SetUrlCacheEntryInfoA(LPCSTR lpszUrlName, ...@@ -2041,8 +2041,8 @@ BOOL WINAPI SetUrlCacheEntryInfoA(LPCSTR lpszUrlName,
pEntry = (entry_header*)((LPBYTE)pHeader + pHashEntry->offset); pEntry = (entry_header*)((LPBYTE)pHeader + pHashEntry->offset);
if (pEntry->signature != URL_SIGNATURE) 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))); 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); SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE; return FALSE;
} }
...@@ -2111,9 +2111,9 @@ static BOOL urlcache_entry_get_file(const char *url, void *entry_info, DWORD *si ...@@ -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); url_entry = (entry_url*)((LPBYTE)header + hash_entry->offset);
if(url_entry->header.signature != URL_SIGNATURE) { if(url_entry->header.signature != URL_SIGNATURE) {
cache_container_unlock_index(container, header);
FIXME("Trying to retrieve entry of unknown format %s\n", FIXME("Trying to retrieve entry of unknown format %s\n",
debugstr_an((LPSTR)&url_entry->header.signature, sizeof(DWORD))); debugstr_an((LPSTR)&url_entry->header.signature, sizeof(DWORD)));
cache_container_unlock_index(container, header);
SetLastError(ERROR_FILE_NOT_FOUND); SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE; return FALSE;
} }
...@@ -4004,9 +4004,9 @@ BOOL WINAPI IsUrlCacheEntryExpiredA(LPCSTR url, DWORD dwFlags, FILETIME* pftLast ...@@ -4004,9 +4004,9 @@ BOOL WINAPI IsUrlCacheEntryExpiredA(LPCSTR url, DWORD dwFlags, FILETIME* pftLast
pEntry = (const entry_header*)((LPBYTE)pHeader + pHashEntry->offset); pEntry = (const entry_header*)((LPBYTE)pHeader + pHashEntry->offset);
if (pEntry->signature != URL_SIGNATURE) 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); cache_container_unlock_index(pContainer, pHeader);
memset(pftLastModified, 0, sizeof(*pftLastModified)); memset(pftLastModified, 0, sizeof(*pftLastModified));
FIXME("Trying to retrieve entry of unknown format %s\n", debugstr_an((LPCSTR)&pEntry->signature, sizeof(DWORD)));
return TRUE; return TRUE;
} }
......
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