diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-01-29 18:16:08 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-01-29 18:16:08 +0000 |
commit | 836ed3dbae80d84baa04fcab2be9c127188f426b (patch) | |
tree | e0046e35546def6b1955909a6dce7b7839f9998f /src/util.c | |
parent | a07a5da0cf7a41c751f4373ac8d5622a342527bd (diff) | |
download | rspamd-836ed3dbae80d84baa04fcab2be9c127188f426b.tar.gz rspamd-836ed3dbae80d84baa04fcab2be9c127188f426b.zip |
Fix GString expanding.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c index 3bf98a536..2afda3546 100644 --- a/src/util.c +++ b/src/util.c @@ -2184,17 +2184,19 @@ static int rspamd_gstring_append_character (unsigned char c, size_t len, void *ud) { GString *buf = ud; + gsize old_len; if (len == 1) { g_string_append_c (buf, c); } else { if (buf->allocated_len - buf->len <= len) { + old_len = buf->len; g_string_set_size (buf, buf->len + len + 1); + buf->len = old_len; } memset (&buf->str[buf->len], c, len); buf->len += len; - buf->str[buf->len] = '\0'; } return 0; |