diff options
author | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-09 04:43:00 +0000 |
---|---|---|
committer | nsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-09 04:43:00 +0000 |
commit | 61198eeba940f70a9ecaa36faa9e5b84555011ea (patch) | |
tree | e651002716949f84f3a6555166e33c6e9cb7034f | |
parent | 0902227706471f17d590836b218179f04caa8dda (diff) | |
download | chromium_src-61198eeba940f70a9ecaa36faa9e5b84555011ea.zip chromium_src-61198eeba940f70a9ecaa36faa9e5b84555011ea.tar.gz chromium_src-61198eeba940f70a9ecaa36faa9e5b84555011ea.tar.bz2 |
Fix proxy code. The pac string was corrupted when a pac
file was specified.
This is because AsciiToWide returns a temporary object, and
we use .c_str, but as soon as the line is executed, the
object is destroyed and what was pointed by c_str is also
deleted.
Use a local variable instead.
Thanks for griffinz@gmail.com for pointing the issue.
Review URL: http://codereview.chromium.org/1838
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1890 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/proxy/proxy_resolver_winhttp.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/proxy/proxy_resolver_winhttp.cc b/net/proxy/proxy_resolver_winhttp.cc index fe0d005..beb079e 100644 --- a/net/proxy/proxy_resolver_winhttp.cc +++ b/net/proxy/proxy_resolver_winhttp.cc @@ -92,8 +92,9 @@ int ProxyResolverWinHttp::GetProxyForURL(const std::string& query_url, WINHTTP_AUTOPROXY_OPTIONS options = {0}; options.fAutoLogonIfChallenged = TRUE; options.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL; + std::wstring pac_url_wide = ASCIIToWide(pac_url); options.lpszAutoConfigUrl = - pac_url.empty() ? L"http://wpad/wpad.dat" : ASCIIToWide(pac_url).c_str(); + pac_url_wide.empty() ? L"http://wpad/wpad.dat" : pac_url_wide.c_str(); WINHTTP_PROXY_INFO info = {0}; DCHECK(session_handle_); |