]> sjero.net Git - wget/commitdiff
Fix underflow, incorrect assertion.
authorAlexander Drozdov <dzal_mail@mtu-net.ru>
Fri, 31 Oct 2008 18:13:10 +0000 (11:13 -0700)
committerAlexander Drozdov <dzal_mail@mtu-net.ru>
Fri, 31 Oct 2008 18:13:10 +0000 (11:13 -0700)
src/ChangeLog
src/ftp-ls.c
src/retr.c

index e4f98d75f56577627831e8731c9b7fd54355360a..8a162245c09b1f440fd98466fb6e1f25ba31fed8 100644 (file)
@@ -1,3 +1,9 @@
+2008-10-31  Alexander Drozdov  <dzal_mail@mtu-net.ru>
+
+       * retr.c (fd_read_hunk): Make assert deal with maxsize == 0.
+
+       * ftp-ls.c (clean_line): Prevent underflow on empty lines.
+
 2008-10-26  Gisle Vanem  <gvanem@broadpark.no>
 
        * main.c (format_and_print_line): Put variables on top of
 2008-10-26  Gisle Vanem  <gvanem@broadpark.no>
 
        * main.c (format_and_print_line): Put variables on top of
index 409996c350d2ad2f9e25e030e03b16558b4b9be9..660302e5b33a51ad8178a3bf30181b4cef47c5d4 100644 (file)
@@ -75,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] == '\n')
     line[--len] = '\0';
+  if (!len) return 0; 
   if (line[len - 1] == '\r')
     line[--len] = '\0';
   for ( ; *line ; line++ ) if (*line == '\t') *line = ' '; 
   if (line[len - 1] == '\r')
     line[--len] = '\0';
   for ( ; *line ; line++ ) if (*line == '\t') *line = ' '; 
index 857742979e397748f3932d566d77ecf0d89dcd7b..21c9002eaaf5905f16c5c845172645128f3bf559 100644 (file)
@@ -393,7 +393,7 @@ fd_read_hunk (int fd, hunk_terminator_t terminator, long sizehint, long maxsize)
   char *hunk = xmalloc (bufsize);
   int tail = 0;                 /* tail position in HUNK */
 
   char *hunk = xmalloc (bufsize);
   int tail = 0;                 /* tail position in HUNK */
 
-  assert (maxsize >= bufsize);
+  assert (!maxsize || maxsize >= bufsize);
 
   while (1)
     {
 
   while (1)
     {