[PATCH v2 0/1] MR5577: winhttp: Use GlobalAlloc to allocate lpszProxy in WinHttpGetProxyForUrl.
-- v2: winhttp: Use GlobalAlloc to allocate lpszProxy in WinHttpGetProxyForUrl. https://gitlab.winehq.org/wine/wine/-/merge_requests/5577
From: Piotr Caban <piotr(a)codeweavers.com> --- dlls/winhttp/session.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index 7860bf757f4..74c8d973f35 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -1896,7 +1896,17 @@ static BOOL parse_script_result( const char *result, WINHTTP_PROXY_INFO *info ) p += 5; while (*p == ' ') p++; if (!*p || *p == ';') return TRUE; - if (!(info->lpszProxy = q = strdupAW( p ))) return FALSE; + if (!(q = strdupAW( p ))) return FALSE; + len = wcslen( q ); + info->lpszProxy = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ); + if (!info->lpszProxy) + { + free( q ); + return FALSE; + } + memcpy( info->lpszProxy, q, (len + 1) * sizeof(WCHAR) ); + free( q ); + q = info->lpszProxy; info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY; for (; *q; q++) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5577
On Fri May 3 13:39:32 2024 +0000, Hans Leidekker wrote:
You can remove the first assignment to info->lpszProxy. done
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/5577#note_69532
This merge request was approved by Hans Leidekker. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5577
participants (3)
-
Hans Leidekker (@hans) -
Piotr Caban -
Piotr Caban (@piotr)