aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-01-04 00:27:01 +0100
committerDaniel Stenberg <daniel@haxx.se>2014-01-04 00:38:43 +0100
commit602d28a210ee47a8a2c2f1e0bbd9fb633637272b (patch)
tree890381a762121b245746e0f3f71595901551a7ee
parent404794e97a62182813322d72a213a834bd579dba (diff)
FTP parselist: fix "total" parser
A regression introduced in 7f3b87d8782eae1 (present in the 7.21.4 release) broke the total parser. Now skip the whitespace and the digits. Reported-by: Justin Maggard Bug: http://curl.haxx.se/mail/lib-2014-01/0019.html
-rw-r--r--lib/ftplistparser.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c
index cb3601f58..4a46dd130 100644
--- a/lib/ftplistparser.c
+++ b/lib/ftplistparser.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -449,9 +449,12 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
finfo->b_data[parser->item_length - 1] = 0;
if(strncmp("total ", finfo->b_data, 6) == 0) {
char *endptr = finfo->b_data+6;
- /* here we can deal with directory size */
+ /* here we can deal with directory size, pass the leading white
+ spaces and then the digits */
while(ISSPACE(*endptr))
endptr++;
+ while(ISDIGIT(*endptr))
+ endptr++;
if(*endptr != 0) {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
return bufflen;