1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Fix underflow, incorrect assertion.

This commit is contained in:
Alexander Drozdov 2008-10-31 11:13:10 -07:00
parent 1228f812fa
commit b0bdf95494
3 changed files with 8 additions and 1 deletions

View 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

View 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] == '\r')
line[--len] = '\0';
for ( ; *line ; line++ ) if (*line == '\t') *line = ' ';

View 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 */
assert (maxsize >= bufsize);
assert (!maxsize || maxsize >= bufsize);
while (1)
{