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

Unified Diff: net/url_request/ftp_protocol_handler.cc

Issue 10834053: Bug fix for lack of errors on requests with invalid ports (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added include Created 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/ftp_protocol_handler.cc
diff --git a/net/url_request/ftp_protocol_handler.cc b/net/url_request/ftp_protocol_handler.cc
index e10a1cdba147702909e466015bb8d802b33ee840..b9dc0fa05f8201cc0ca6b8e21690b7e8934909b5 100644
--- a/net/url_request/ftp_protocol_handler.cc
+++ b/net/url_request/ftp_protocol_handler.cc
@@ -5,7 +5,12 @@
#include "net/url_request/ftp_protocol_handler.h"
#include "base/logging.h"
+#include "net/base/net_errors.h"
+#include "net/base/net_util.h"
+#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_ftp_job.h"
+#include "googleurl/src/gurl.h"
namespace net {
@@ -22,6 +27,12 @@ FtpProtocolHandler::FtpProtocolHandler(
URLRequestJob* FtpProtocolHandler::MaybeCreateJob(
URLRequest* request) const {
+ int port = request->url().IntPort();
+ if (request->url().has_port() &&
+ !IsPortAllowedByFtp(port) && !IsPortAllowedByOverride(port)) {
+ return new URLRequestErrorJob(request, ERR_UNSAFE_PORT);
+ }
+
return new URLRequestFtpJob(request,
network_delegate_,
ftp_transaction_factory_,
« 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