aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/multipattern.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-08-31 17:07:44 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-08-31 17:07:44 +0100
commit7a6c0f7ee28cfaed1c56d78496a557178b90a6bd (patch)
treeef6a04e6d16734297ad269c930d1224d65f902d8 /src/libutil/multipattern.c
parentafb5308643e8c0c822b96df03d5a0b69a96c6d37 (diff)
downloadrspamd-7a6c0f7ee28cfaed1c56d78496a557178b90a6bd.tar.gz
rspamd-7a6c0f7ee28cfaed1c56d78496a557178b90a6bd.zip
[Fix] Fix actrie patterns
Diffstat (limited to 'src/libutil/multipattern.c')
-rw-r--r--src/libutil/multipattern.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libutil/multipattern.c b/src/libutil/multipattern.c
index 1fa1a037b..5f7e48daa 100644
--- a/src/libutil/multipattern.c
+++ b/src/libutil/multipattern.c
@@ -269,7 +269,7 @@ rspamd_multipattern_escape_tld_acism (const gchar *pattern, gsize len,
res = g_malloc (dlen + 1);
slen = strlen (prefix);
memcpy (res, prefix, slen);
- memcpy (res + slen, p, dlen - slen);
+ rspamd_strlcpy (res + slen, p, dlen - slen + 1);
*dst_len = dlen;
@@ -309,9 +309,8 @@ rspamd_multipattern_pattern_filter (const gchar *pattern, gsize len,
ret = rspamd_multipattern_escape_tld_acism (pattern, len, dst_len);
}
else {
- ret = malloc (len);
- memcpy (ret, pattern, len);
- *dst_len = len;
+ ret = malloc (len + 1);
+ *dst_len = rspamd_strlcpy (ret, pattern, len + 1);
}
return ret;