From a701d7b797668c33d90c6410331cd7b599f62830 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Wed, 7 Jan 2009 06:15:37 +0100 Subject: [PATCH] Fixed a passdata bug in htparser. --- src/htparser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/htparser.c b/src/htparser.c index 68a3300..cec52dc 100644 --- a/src/htparser.c +++ b/src/htparser.c @@ -213,10 +213,10 @@ static off_t passdata(FILE *in, FILE *out, off_t max) char buf[8192]; total = 0; - while(!feof(in)) { + while(!feof(in) && (total < max)) { read = sizeof(buf); if(max >= 0) - read = max(max - total, read); + read = min(max - total, read); read = fread(buf, 1, read, in); if(ferror(in)) return(-1); -- 2.11.0