Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: net/http/http_util.cc

Issue 2134083003: Reject line terminators in HttpUtil::IsValidHeaderValue() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes from mmenke Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/http/http_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_util.cc
diff --git a/net/http/http_util.cc b/net/http/http_util.cc
index 1f1ef91d01e3ea33bc8e904f689321f26ecccc71..313da11a66f118b55043627976c6e7164f527c8b 100644
--- a/net/http/http_util.cc
+++ b/net/http/http_util.cc
@@ -347,9 +347,8 @@ bool HttpUtil::IsValidHeaderName(const std::string& name) {
// static
bool HttpUtil::IsValidHeaderValue(const std::string& value) {
- // Just a sanity check: disallow NUL and CRLF.
- return value.find('\0') == std::string::npos &&
- value.find("\r\n") == std::string::npos;
+ // Just a sanity check: disallow NUL, CR and LF.
+ return value.find_first_of("\0\r\n", 0, 3) == std::string::npos;
}
// static
« no previous file with comments | « no previous file | net/http/http_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698