From a03a1d3847ddbc5687f4d3cf8568ecd8444d527f Mon Sep 17 00:00:00 2001 From: Robert James Kaes Date: Mon, 26 Nov 2001 01:39:07 +0000 Subject: Fixed a problem with not buffering more than 2K (which is obviously a problem. :) --- src/buffer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/buffer.c b/src/buffer.c index faf871d..f60d5a2 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1,4 +1,4 @@ -/* $Id: buffer.c,v 1.17 2001-11-25 22:05:42 rjkaes Exp $ +/* $Id: buffer.c,v 1.18 2001-11-26 01:39:07 rjkaes Exp $ * * The buffer used in each connection is a linked list of lines. As the lines * are read in and written out the buffer expands and contracts. Basically, @@ -197,10 +197,13 @@ read_buffer(int fd, struct buffer_s * buffptr) assert(fd >= 0); assert(buffptr != NULL); - if (BUFFER_SIZE(buffptr) >= READ_BUFFER_SIZE) + /* + * Don't allow the buffer to grow larger than MAXBUFFSIZE + */ + if (BUFFER_SIZE(buffptr) >= MAXBUFFSIZE) return 0; - bytesin = read(fd, buffer, READ_BUFFER_SIZE - BUFFER_SIZE(buffptr)); + bytesin = read(fd, buffer, READ_BUFFER_SIZE); if (bytesin > 0) { if (add_to_buffer(buffptr, buffer, bytesin) < 0) { -- cgit v1.2.3