From: Adam Dickmeiss Date: Wed, 24 Jan 1996 08:25:32 +0000 (+0000) Subject: Buf fix: Uninitialized outbuffer_offset member. X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=95847d2bfe19cbe5533cd25df3e6a64f9bd4b062;p=egate.git Buf fix: Uninitialized outbuffer_offset member. --- 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;