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

Unified Diff: net/ftp/ftp_network_transaction.cc

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « net/ftp/ftp_network_transaction.h ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_network_transaction.cc
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc
index 4cbde2725b0b8c1f9bd2601f40b58dd0321a60f8..74bd6bf6f8dcdb9109dbc953fbeb5649084b4c02 100644
--- a/net/ftp/ftp_network_transaction.cc
+++ b/net/ftp/ftp_network_transaction.cc
@@ -965,14 +965,16 @@ int FtpNetworkTransaction::ProcessResponseEPSV(
switch (GetErrorClass(response.status_code)) {
case ERROR_CLASS_INITIATED:
return Stop(ERR_INVALID_RESPONSE);
- case ERROR_CLASS_OK:
- if (!ExtractPortFromEPSVResponse( response, &data_connection_port_))
+ case ERROR_CLASS_OK: {
+ int port;
+ if (!ExtractPortFromEPSVResponse(response, &port))
return Stop(ERR_INVALID_RESPONSE);
- if (data_connection_port_ < 1024 ||
- !IsPortAllowedByFtp(data_connection_port_))
+ if (port < 1024 || !IsPortAllowedByFtp(port))
return Stop(ERR_UNSAFE_PORT);
+ data_connection_port_ = static_cast<uint16>(port);
next_state_ = STATE_DATA_CONNECT;
break;
+ }
case ERROR_CLASS_INFO_NEEDED:
return Stop(ERR_INVALID_RESPONSE);
case ERROR_CLASS_TRANSIENT_ERROR:
@@ -999,14 +1001,16 @@ int FtpNetworkTransaction::ProcessResponsePASV(
switch (GetErrorClass(response.status_code)) {
case ERROR_CLASS_INITIATED:
return Stop(ERR_INVALID_RESPONSE);
- case ERROR_CLASS_OK:
- if (!ExtractPortFromPASVResponse(response, &data_connection_port_))
+ case ERROR_CLASS_OK: {
+ int port;
+ if (!ExtractPortFromPASVResponse(response, &port))
return Stop(ERR_INVALID_RESPONSE);
- if (data_connection_port_ < 1024 ||
- !IsPortAllowedByFtp(data_connection_port_))
+ if (port < 1024 || !IsPortAllowedByFtp(port))
return Stop(ERR_UNSAFE_PORT);
+ data_connection_port_ = static_cast<uint16>(port);
next_state_ = STATE_DATA_CONNECT;
break;
+ }
case ERROR_CLASS_INFO_NEEDED:
return Stop(ERR_INVALID_RESPONSE);
case ERROR_CLASS_TRANSIENT_ERROR:
« no previous file with comments | « net/ftp/ftp_network_transaction.h ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698