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

Unified Diff: net/http/http_stream_factory.cc

Issue 1893433003: Reject port numbers that contain a leading '+' in HttpStreamFactory::ProcessAlternateProtocol(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for real Created 4 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_stream_factory.cc
diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc
index 6ea3224dc96cb3534ca9788d0fdacf0767a5bbb2..0f2cf40abe7128d3e76b420b336f5776bb665ed5 100644
--- a/net/http/http_stream_factory.cc
+++ b/net/http/http_stream_factory.cc
@@ -11,6 +11,7 @@
#include "base/time/time.h"
#include "net/base/host_mapping_rules.h"
#include "net/base/host_port_pair.h"
+#include "net/base/parse_number.h"
#include "net/base/port_util.h"
#include "net/http/http_network_session.h"
#include "net/http/http_response_headers.h"
@@ -168,7 +169,8 @@ void HttpStreamFactory::ProcessAlternateProtocol(
break;
}
- if (!base::StringToInt(port_protocol_vector[0], &port) ||
+ if (!ParseInt32(port_protocol_vector[0], ParseIntFormat::NON_NEGATIVE,
+ &port) ||
port == 0 || !IsPortValid(port)) {
DVLOG(1) << kAlternateProtocolHeader
<< " header has unrecognizable port: "
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698