aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/rspamdclient.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-29 18:16:08 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-29 18:16:08 +0000
commit836ed3dbae80d84baa04fcab2be9c127188f426b (patch)
treee0046e35546def6b1955909a6dce7b7839f9998f /src/client/rspamdclient.c
parenta07a5da0cf7a41c751f4373ac8d5622a342527bd (diff)
downloadrspamd-836ed3dbae80d84baa04fcab2be9c127188f426b.tar.gz
rspamd-836ed3dbae80d84baa04fcab2be9c127188f426b.zip
Fix GString expanding.
Diffstat (limited to 'src/client/rspamdclient.c')
-rw-r--r--src/client/rspamdclient.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/client/rspamdclient.c b/src/client/rspamdclient.c
index e8f7dfe87..293c49214 100644
--- a/src/client/rspamdclient.c
+++ b/src/client/rspamdclient.c
@@ -151,7 +151,7 @@ rspamd_client_command (struct rspamd_client_connection *conn,
{
struct rspamd_client_request *req;
gchar *p, *hn, *hv;
- gsize remain;
+ gsize remain, old_len;
GHashTableIter it;
req = g_slice_alloc (sizeof (struct rspamd_client_request));
@@ -167,7 +167,10 @@ rspamd_client_command (struct rspamd_client_connection *conn,
p = req->msg->body->str + req->msg->body->len;
remain = req->msg->body->allocated_len - req->msg->body->len - 1;
if (remain == 0) {
- g_string_set_size (req->msg->body, req->msg->body->len * 2);
+ old_len = req->msg->body->len;
+ g_string_set_size (req->msg->body, old_len * 2);
+ req->msg->body->len = old_len;
+ continue;
}
remain = fread (p, 1, remain, in);
if (remain > 0) {