]> sjero.net Git - wget/blobdiff - src/ftp-ls.c
Fix underflow, incorrect assertion.
[wget] / src / ftp-ls.c
index 67e9bc513f6a73567de05b691f60d485904a723b..660302e5b33a51ad8178a3bf30181b4cef47c5d4 100644 (file)
@@ -28,8 +28,6 @@ Corresponding Source for a non-source form of such a combination
 shall include the source code for the parts of OpenSSL used as well
 as that of the covered work.  */
 
-#define USE_GNULIB_ALLOC
-
 #include "wget.h"
 
 #include <stdio.h>
@@ -77,6 +75,7 @@ clean_line(char *line)
   if (!len) return 0; 
   if (line[len - 1] == '\n')
     line[--len] = '\0';
+  if (!len) return 0; 
   if (line[len - 1] == '\r')
     line[--len] = '\0';
   for ( ; *line ; line++ ) if (*line == '\t') *line = ' '; 
@@ -896,7 +895,8 @@ ftp_index (const char *file, struct url *u, struct fileinfo *f)
             "Jan", "Feb", "Mar", "Apr", "May", "Jun",
             "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
           };
-          struct tm *ptm = localtime ((time_t *)&f->tstamp);
+          time_t tstamp = f->tstamp;
+          struct tm *ptm = localtime (&tstamp);
 
           fprintf (fp, "%d %s %02d ", ptm->tm_year + 1900, months[ptm->tm_mon],
                   ptm->tm_mday);