From: Vsevolod Stakhov Date: Tue, 27 Jul 2010 16:08:50 +0000 (+0400) Subject: * Allocate some more bytes for read buffer to avoid incorrect behavoiur X-Git-Tag: 0.3.1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e21bec8896c0d9455ae1af28a577b6e0c20cc8f6;p=thirdparty%2Frspamd.git * Allocate some more bytes for read buffer to avoid incorrect behavoiur --- diff --git a/src/buffer.c b/src/buffer.c index 6c68875576..d0c36f8eaf 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -268,7 +268,7 @@ read_buffers (int fd, rspamd_io_dispatcher_t * d, gboolean skip_read) d->in_buf->data = fstralloc (d->pool, BUFSIZ); } else { - d->in_buf->data = fstralloc (d->pool, d->nchars); + d->in_buf->data = fstralloc (d->pool, d->nchars + 1); } d->in_buf->pos = d->in_buf->data->begin; } @@ -535,7 +535,7 @@ rspamd_set_dispatcher_policy (rspamd_io_dispatcher_t * d, enum io_policy policy, /* Resize input buffer if needed */ if (policy == BUFFER_CHARACTER && nchars != 0) { if (d->in_buf && d->in_buf->data->size < nchars) { - tmp = fstralloc (d->pool, d->nchars); + tmp = fstralloc (d->pool, d->nchars + 1); memcpy (tmp->begin, d->in_buf->data->begin, d->in_buf->data->len); t = d->in_buf->pos - d->in_buf->data->begin; tmp->len = d->in_buf->data->len;