summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-11 19:43:53 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-11 19:43:53 +0000
commit3c0232dc6bfa82b2c56410a99d54f6830eaee2c8 (patch)
tree86700393c7c3d56f681c180eed24fd99e350fb8f /chrome_frame
parent7271ae675d6ae3d98db54134267a41d1f683ea92 (diff)
downloadchromium_src-3c0232dc6bfa82b2c56410a99d54f6830eaee2c8.zip
chromium_src-3c0232dc6bfa82b2c56410a99d54f6830eaee2c8.tar.gz
chromium_src-3c0232dc6bfa82b2c56410a99d54f6830eaee2c8.tar.bz2
Fix a crash in the code which attempts to append the user agent to the list of outgoing
headers in ChromeFrame sub requests. The crash occurs because the current headers passed in the BeginningTransaction are NULL. Fixes bug http://code.google.com/p/chromium/issues/detail?id=62853 Bug=62853 Review URL: http://codereview.chromium.org/4792002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65834 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/http_negotiate.cc29
1 files changed, 15 insertions, 14 deletions
diff --git a/chrome_frame/http_negotiate.cc b/chrome_frame/http_negotiate.cc
index 9d8344e..aea995a 100644
--- a/chrome_frame/http_negotiate.cc
+++ b/chrome_frame/http_negotiate.cc
@@ -135,22 +135,23 @@ std::string ReplaceOrAddUserAgent(LPCWSTR headers,
DCHECK(headers);
using net::HttpUtil;
- std::string ascii_headers(WideToASCII(headers));
-
- // Extract "User-Agent" from the headers.
- HttpUtil::HeadersIterator headers_iterator(ascii_headers.begin(),
- ascii_headers.end(), "\r\n");
-
- // Build new headers, skip the existing user agent value from
- // existing headers.
- std::string new_headers;
- while (headers_iterator.GetNext()) {
- std::string name(headers_iterator.name());
- if (!LowerCaseEqualsASCII(name, kLowerCaseUserAgent)) {
- new_headers += name + ": " + headers_iterator.values() + "\r\n";
+ if (headers) {
+ std::string ascii_headers(WideToASCII(headers));
+
+ // Extract "User-Agent" from the headers.
+ HttpUtil::HeadersIterator headers_iterator(ascii_headers.begin(),
+ ascii_headers.end(), "\r\n");
+
+ // Build new headers, skip the existing user agent value from
+ // existing headers.
+ std::string new_headers;
+ while (headers_iterator.GetNext()) {
+ std::string name(headers_iterator.name());
+ if (!LowerCaseEqualsASCII(name, kLowerCaseUserAgent)) {
+ new_headers += name + ": " + headers_iterator.values() + "\r\n";
+ }
}
}
-
new_headers += "User-Agent: " + user_agent_value;
new_headers += "\r\n";
return new_headers;