aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-27 20:08:50 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-07-27 20:08:50 +0400
commite21bec8896c0d9455ae1af28a577b6e0c20cc8f6 (patch)
treed98bd4fcc9205b7c008b0692306940f94d5f0281
parentf216d5a0fb7e1d50467182c04d72ecfd347d483f (diff)
downloadrspamd-e21bec8896c0d9455ae1af28a577b6e0c20cc8f6.tar.gz
rspamd-e21bec8896c0d9455ae1af28a577b6e0c20cc8f6.zip
* Allocate some more bytes for read buffer to avoid incorrect behavoiur
-rw-r--r--src/buffer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 6c6887557..d0c36f8ea 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;