From 95847d2bfe19cbe5533cd25df3e6a64f9bd4b062 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 24 Jan 1996 08:25:32 +0000 Subject: [PATCH] Buf fix: Uninitialized outbuffer_offset member. --- www/wproto.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/www/wproto.c b/www/wproto.c index 51130f9..35479b3 100644 --- a/www/wproto.c +++ b/www/wproto.c @@ -41,7 +41,10 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wproto.c,v $ - * Revision 1.14 1996/01/12 13:08:07 adam + * Revision 1.15 1996/01/24 08:25:32 adam + * Buf fix: Uninitialized outbuffer_offset member. + * + * Revision 1.14 1996/01/12 13:08:07 adam * CGI script passes name of lock file to the shell. The server will not close * the response FIFO until this file becomes unlocked. This method handles * cancel operations much better. @@ -124,7 +127,7 @@ void wo_write (WCLIENT wc, const char *s, size_t len) { if (wc->outbuffer_offset + len >= wc->outbuffer_size) wc->outbuffer = realloc(wc->outbuffer, wc->outbuffer_size += - OUTBUFFER_CHUNK); + ((len >= OUTBUFFER_CHUNK) ? len*2 : OUTBUFFER_CHUNK)); memcpy(wc->outbuffer + wc->outbuffer_offset, s, len); wc->outbuffer_offset += len; } @@ -147,8 +150,6 @@ void wo_printf (WCLIENT wc, const char *fmt, ...) void wo_clear (WCLIENT wc, const char *type) { - if (!wc->outbuffer) - wc->outbuffer = malloc(wc->outbuffer_size = OUTBUFFER_CHUNK); wc->outbuffer_offset = 0; if (type) wo_printf(wc, "Content-type: %s\n\n", type); @@ -447,6 +448,8 @@ WCLIENT wproto_init(void) exit(1); } new->outbuffer = 0; + new->outbuffer_size = 0; + new->outbuffer_offset = 0; new->cache_level = -1; new->cache_fd = -1; return new; -- 1.7.10.4