{
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));
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) {
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;