From b2b632794ac25b34bf1d108043d053c8cc5012fc Mon Sep 17 00:00:00 2001 From: cperciva Date: Thu, 18 Nov 2004 12:01:30 +0000 Subject: Fix buffer overflow. This is FreeBSD-SA-04:16.fetch. Approved by: des --- usr.bin/fetch/fetch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'usr.bin/fetch/fetch.c') diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c index ffcbc43..2834e0b5 100644 --- a/usr.bin/fetch/fetch.c +++ b/usr.bin/fetch/fetch.c @@ -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; -- cgit v1.1