From c069403b75cdcbe3462f59969aaa4869ef548c26 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Wed, 27 Feb 2008 13:22:12 +0100 Subject: [PATCH] FTP: Test and fix handling of symbolic link name containing spaces The bug was reported by Paul B. Mahol on elinks-users. The example is from the FTP site he provided: ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-ia64/ Message-ID: <3a142e750802262008l6fd55be5v44207bc4479dd3fc@mail.gmail.com> --- src/protocol/ftp/parse.c | 2 +- src/protocol/ftp/test-ftp-parser | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/protocol/ftp/parse.c b/src/protocol/ftp/parse.c index be4326e7..8048406a 100644 --- a/src/protocol/ftp/parse.c +++ b/src/protocol/ftp/parse.c @@ -345,7 +345,7 @@ parse_ftp_unix_response(struct ftp_file_info *info, unsigned char *src, int len) break; } - pos = memchr(pos, ' ', end - pos); + pos = memchr(pos + 1, ' ', end - pos); } if (!info->symlink.source) diff --git a/src/protocol/ftp/test-ftp-parser b/src/protocol/ftp/test-ftp-parser index 860056dd..370e2237 100644 --- a/src/protocol/ftp/test-ftp-parser +++ b/src/protocol/ftp/test-ftp-parser @@ -62,6 +62,11 @@ test_ftp_response_expect_success \ -rwxrwxrwx 1 noone nogroup 322 Aug 19 1996 message.ftp\r\n" test_ftp_response_expect_success \ +'Response from FreeBSD with symbolic link' \ +" +lrwxrwx--x 1 110 1002 13 Oct 24 2006 5.3 has moved to ftp-archive -> ../README.TXT\r\n" + +test_ftp_response_expect_success \ 'Response from NetWare' \ " d[R----F--] supervisor 512 Jan 16 18:53 login\r\n -- 2.11.4.GIT