aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2004-11-18 12:01:30 +0000
committerColin Percival <cperciva@FreeBSD.org>2004-11-18 12:01:30 +0000
commit8c355b08895c92abe5fe4ecbe0f34f3cfb94ea1a (patch)
treefb1961c09902c6c30aca40f5c6c80b24d92ffce6 /usr.bin
parent405e2987cae2443cb19b3c1b0316c1e599cf03c8 (diff)
downloadsrc-8c355b08895c92abe5fe4ecbe0f34f3cfb94ea1a.tar.gz
src-8c355b08895c92abe5fe4ecbe0f34f3cfb94ea1a.zip
Fix buffer overflow. This is FreeBSD-SA-04:16.fetch.
Approved by: des
Notes
Notes: svn path=/head/; revision=137854
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/fetch/fetch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c
index ffcbc43d05dc..2834e0b5902c 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;