Module: wine Branch: master Commit: 9312c453785ebf3885723979aa6c60010787f66e URL: https://gitlab.winehq.org/wine/wine/-/commit/9312c453785ebf3885723979aa6c600...
Author: Piotr Caban piotr@codeweavers.com Date: Fri May 3 14:50:58 2024 +0200
winhttp: Use GlobalAlloc to allocate lpszProxy in WinHttpGetProxyForUrl.
---
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++) {