[PATCH] wininet: Prevent use after free in logging.

Jan Sikorski jsikorski at codeweavers.com
Fri Oct 30 06:13:23 CDT 2020


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

Signed-off-by: Jan Sikorski <jsikorski at codeweavers.com>
---
 dlls/wininet/urlcache.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/wininet/urlcache.c b/dlls/wininet/urlcache.c
index 3275cb19e6a..4a397b6b4de 100644
--- a/dlls/wininet/urlcache.c
+++ b/dlls/wininet/urlcache.c
@@ -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;
     }
 
-- 
2.27.0




More information about the wine-devel mailing list