From ef9a828ef8543299d983e785a7eb14ffe7600624 Mon Sep 17 00:00:00 2001 From: winesync Date: Tue, 8 Dec 2020 18:17:50 +0100 Subject: [PATCH] [WINESYNC] 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 Signed-off-by: Alexandre Julliard wine commit id bcdb58cc7959afd5fa35ab039e6564934888b4c0 by Jan Sikorski --- dll/win32/wininet/urlcache.c | 8 ++++---- sdk/tools/winesync/wininet.cfg | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dll/win32/wininet/urlcache.c b/dll/win32/wininet/urlcache.c index 9e3659000f9..de0d21af24e 100644 --- a/dll/win32/wininet/urlcache.c +++ b/dll/win32/wininet/urlcache.c @@ -1841,9 +1841,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; } @@ -2074,8 +2074,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; } @@ -2144,9 +2144,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; } @@ -4037,9 +4037,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; } diff --git a/sdk/tools/winesync/wininet.cfg b/sdk/tools/winesync/wininet.cfg index 5e68252160e..6757964181c 100644 --- a/sdk/tools/winesync/wininet.cfg +++ b/sdk/tools/winesync/wininet.cfg @@ -5,4 +5,4 @@ files: include/wininet.h: sdk/include/psdk/wininet.h include/winineti.h: sdk/include/psdk/winineti.h tags: - wine: ef88a70fa775f3e7a26d8f1618f32ee94bb9ea05 + wine: bcdb58cc7959afd5fa35ab039e6564934888b4c0