Fix buffer overflow. This is FreeBSD-SA-04:16.fetch.

Approved by:	des
This commit is contained in:
Colin Percival 2004-11-18 12:01:30 +00:00
parent 405e2987ca
commit 8c355b0889

View file

@ -584,7 +584,8 @@ fetch(char *URL, const char *path)
/* suck in the data */
signal(SIGINFO, sig_handler);
while (!sigint) {
if (us.size != -1 && us.size - count < B_size)
if (us.size != -1 && us.size - count < B_size &&
us.size - count >= 0)
size = us.size - count;
else
size = B_size;