diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-31 07:16:59 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-31 07:16:59 +0000 |
commit | 7cc9929276a9a927ef3589109717f0765239e2af (patch) | |
tree | d10cfad399b480359f6cdf517cbc65c7089b2b17 /net/http/http_auth.cc | |
parent | 1255b5d9b20f8c23a1980ef270c09bbb07683418 (diff) | |
download | chromium_src-7cc9929276a9a927ef3589109717f0765239e2af.zip chromium_src-7cc9929276a9a927ef3589109717f0765239e2af.tar.gz chromium_src-7cc9929276a9a927ef3589109717f0765239e2af.tar.bz2 |
Gracefully recover from malformed auth challenge.
BUG=39836
TEST=try to log in to an allnet webcam
Review URL: http://codereview.chromium.org/1567008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43182 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_auth.cc')
-rw-r--r-- | net/http/http_auth.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/net/http/http_auth.cc b/net/http/http_auth.cc index 83da9ad..540edf9 100644 --- a/net/http/http_auth.cc +++ b/net/http/http_auth.cc @@ -84,6 +84,9 @@ void HttpAuth::ChallengeTokenizer::Init(std::string::const_iterator begin, // name="value" // name=value // name= +// Due to buggy implementations found in some embedded devices, we also +// accept values with missing close quotemark (http://crbug.com/39836): +// name="value bool HttpAuth::ChallengeTokenizer::GetNext() { if (!props_.GetNext()) return false; @@ -123,13 +126,13 @@ bool HttpAuth::ChallengeTokenizer::GetNext() { name_end_ = equals; value_begin_ = equals + 1; + value_is_quoted_ = false; if (value_begin_ != value_end_ && HttpUtil::IsQuote(*value_begin_)) { // Trim surrounding quotemarks off the value - if (*value_begin_ != *(value_end_ - 1)) - return valid_ = false; // Malformed -- mismatching quotes. - value_is_quoted_ = true; - } else { - value_is_quoted_ = false; + if (*value_begin_ != *(value_end_ - 1) || value_begin_ + 1 == value_end_) + value_begin_ = equals + 2; // Gracefully recover from mismatching quotes. + else + value_is_quoted_ = true; } return true; } |