Chromium Code Reviews| Index: net/ftp/ftp_directory_listing_parsers.cc |
| diff --git a/net/ftp/ftp_directory_listing_parsers.cc b/net/ftp/ftp_directory_listing_parsers.cc |
| index c1a7f76028d7a383e10b34e4f536d793608ae12a..60cef806bf043789046fb3d730e49161ea257bde 100644 |
| --- a/net/ftp/ftp_directory_listing_parsers.cc |
| +++ b/net/ftp/ftp_directory_listing_parsers.cc |
| @@ -128,8 +128,12 @@ bool FtpLsDirectoryListingParser::ConsumeLine(const string16& line) { |
| if (!IsStringNonNegativeNumber(columns[1])) |
| return false; |
| - if (!IsStringNonNegativeNumber(columns[4])) |
| + if (!StringToInt64(columns[4], &entry.size)) |
| return false; |
| + if (entry.size < 0) |
| + return false; |
| + if (entry.type != FtpDirectoryListingEntry::FILE) |
|
wtc
2009/10/28 19:12:08
Why don't we test entry.type earlier, like this?
wtc
2009/10/28 23:51:58
I see. Your code will return false if the format
|
| + entry.size = -1; |
| if (!UnixDateListingToTime(columns, &entry.last_modified)) |
| return false; |