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:
parent
1228f812fa
commit
b0bdf95494
@ -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>
|
2008-10-26 Gisle Vanem <gvanem@broadpark.no>
|
||||||
|
|
||||||
* main.c (format_and_print_line): Put variables on top of
|
* main.c (format_and_print_line): Put variables on top of
|
||||||
|
@ -75,6 +75,7 @@ clean_line(char *line)
|
|||||||
if (!len) return 0;
|
if (!len) return 0;
|
||||||
if (line[len - 1] == '\n')
|
if (line[len - 1] == '\n')
|
||||||
line[--len] = '\0';
|
line[--len] = '\0';
|
||||||
|
if (!len) return 0;
|
||||||
if (line[len - 1] == '\r')
|
if (line[len - 1] == '\r')
|
||||||
line[--len] = '\0';
|
line[--len] = '\0';
|
||||||
for ( ; *line ; line++ ) if (*line == '\t') *line = ' ';
|
for ( ; *line ; line++ ) if (*line == '\t') *line = ' ';
|
||||||
|
@ -393,7 +393,7 @@ fd_read_hunk (int fd, hunk_terminator_t terminator, long sizehint, long maxsize)
|
|||||||
char *hunk = xmalloc (bufsize);
|
char *hunk = xmalloc (bufsize);
|
||||||
int tail = 0; /* tail position in HUNK */
|
int tail = 0; /* tail position in HUNK */
|
||||||
|
|
||||||
assert (maxsize >= bufsize);
|
assert (!maxsize || maxsize >= bufsize);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user