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

Unified Diff: net/ftp/ftp_directory_listing_parser_windows.cc

Issue 3013029: Fix a bug with parsing ftp directory listing lines. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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
Index: net/ftp/ftp_directory_listing_parser_windows.cc
===================================================================
--- net/ftp/ftp_directory_listing_parser_windows.cc (revision 53666)
+++ net/ftp/ftp_directory_listing_parser_windows.cc (working copy)
@@ -48,11 +48,18 @@
return false;
if (!StringToInt(time_parts[1], &time_exploded.minute))
return false;
+ if (!time_exploded.HasValidValues())
+ return false;
string16 am_or_pm(columns[1].substr(5, 2));
- if (EqualsASCII(am_or_pm, "PM"))
- time_exploded.hour += 12;
- else if (!EqualsASCII(am_or_pm, "AM"))
+ if (EqualsASCII(am_or_pm, "PM")) {
+ if (time_exploded.hour < 12)
+ time_exploded.hour += 12;
+ } else if (EqualsASCII(am_or_pm, "AM")) {
+ if (time_exploded.hour == 12)
+ time_exploded.hour = 0;
+ } else {
return false;
+ }
// We don't know the time zone of the server, so just use local time.
*time = base::Time::FromLocalExploded(time_exploded);

Powered by Google App Engine
This is Rietveld 408576698