Fix FTP dir listing parser to allow total size to be negative,
which some buggy servers do. Patch by tfh@skip.org R=mmenke@chromium.org BUG=536811 Review URL: https://codereview.chromium.org/1451993007 . Patch from tfh <tfh@skip.org>. Cr-Commit-Position: refs/heads/master@{#360845}
This commit is contained in:
1
AUTHORS
1
AUTHORS
@ -580,6 +580,7 @@ Thomas Conti <tomc@amazon.com>
|
||||
Tiago Vignatti <tiago.vignatti@intel.com>
|
||||
Tim Ansell <mithro@mithis.com>
|
||||
Timo Reimann <ttr314@googlemail.com>
|
||||
Tom Harwood <tfh@skip.org>
|
||||
Torsten Kurbad <google@tk-webart.de>
|
||||
Tomas Popela <tomas.popela@gmail.com>
|
||||
Trevor Perrin <unsafe@trevp.net>
|
||||
|
4
net/data/ftp/dir-listing-ls-33
Normal file
4
net/data/ftp/dir-listing-ls-33
Normal file
@ -0,0 +1,4 @@
|
||||
total -9560322322989056
|
||||
-rw-r--r-- 1 stadmin stgroup 4310450 Nov 17 13:12 01643.001.862.TestPermission-DUP0001.zip
|
||||
-rw-r--r-- 1 stadmin stgroup 2496430080 Nov 13 14:46 I_Base_01_RSE_R720.iso
|
||||
-rw-r--r-- 1 stadmin stgroup 478576612 Nov 13 08:11 I_Base_01_RSE_R720.zip
|
26
net/data/ftp/dir-listing-ls-33.expected
Normal file
26
net/data/ftp/dir-listing-ls-33.expected
Normal file
@ -0,0 +1,26 @@
|
||||
-
|
||||
01643.001.862.TestPermission-DUP0001.zip
|
||||
4310450
|
||||
1993
|
||||
11
|
||||
17
|
||||
13
|
||||
12
|
||||
|
||||
-
|
||||
I_Base_01_RSE_R720.iso
|
||||
2496430080
|
||||
1994
|
||||
11
|
||||
13
|
||||
14
|
||||
46
|
||||
|
||||
-
|
||||
I_Base_01_RSE_R720.zip
|
||||
478576612
|
||||
1994
|
||||
11
|
||||
13
|
||||
8
|
||||
11
|
@ -142,11 +142,12 @@ bool ParseFtpDirectoryListingLs(
|
||||
if (columns.size() == 2 && !received_total_line) {
|
||||
received_total_line = true;
|
||||
|
||||
// Some FTP servers incorrectly return a negative integer for "n". Since
|
||||
// this value is ignored anyway, just check any valid integer was
|
||||
// provided.
|
||||
int64 total_number;
|
||||
if (!base::StringToInt64(columns[1], &total_number))
|
||||
return false;
|
||||
if (total_number < 0)
|
||||
return false;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -156,6 +156,7 @@ const FtpTestParam kTestParams[] = {
|
||||
{"dir-listing-ls-30", OK},
|
||||
{"dir-listing-ls-31", OK},
|
||||
{"dir-listing-ls-32", OK}, // busybox
|
||||
{"dir-listing-ls-33", OK},
|
||||
|
||||
{"dir-listing-netware-1", OK},
|
||||
{"dir-listing-netware-2", OK},
|
||||
|
Reference in New Issue
Block a user