If the directory entry isn't complete line can be NULL.

I ran into it using 'mget -r .' on this FTP server:

ftp://ftp.cs.cmu.edu

Index: list.c
===================================================================
RCS file: /home/cvsync/src/usr.bin/ftp/list.c,v
retrieving revision 1.3
diff -u -r1.3 list.c
--- list.c      5 May 2009 19:35:30 -0000       1.3
+++ list.c      29 Dec 2009 00:55:47 -0000
@@ -34,6 +34,8 @@
                        *type = *tok;

                if (field == 7) {
+                       if (line == NULL);
+                               break;
                        while (**line == ' ' || **line == '\t')
                                (*line)++;
                        break;
@@ -58,6 +60,8 @@
                        *type = 'd';

                if (field == 2) {
+                       if (line == NULL);
+                               break;
                        while (**line == ' ' || **line == '\t')
                                (*line)++;
                        break;

Reply via email to