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_, |