summaryrefslogtreecommitdiffstats
path: root/src/plugins/custom
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-11-16 22:00:29 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-11-16 22:00:29 +0300
commit3ebceeece2204d3755df1f1cc8210f7e97b6daad (patch)
tree38c122341dbbb2f1ea1a4c969ad95dda38c1106e /src/plugins/custom
parentc85dd608a568d61e3b24c55b715ad37ceedb7110 (diff)
downloadrspamd-3ebceeece2204d3755df1f1cc8210f7e97b6daad.tar.gz
rspamd-3ebceeece2204d3755df1f1cc8210f7e97b6daad.zip
Make own strlcpy that does not calculate remaining string length (faster and more safe)
Allow only ASCII symbols in logs, escape control chars
Diffstat (limited to 'src/plugins/custom')
-rw-r--r--src/plugins/custom/regmark/prefix_tree.c4
-rw-r--r--src/plugins/custom/regmark/regmark.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/custom/regmark/prefix_tree.c b/src/plugins/custom/regmark/prefix_tree.c
index 4d593ebbc..5e8607aae 100644
--- a/src/plugins/custom/regmark/prefix_tree.c
+++ b/src/plugins/custom/regmark/prefix_tree.c
@@ -82,7 +82,7 @@ add_string_common (prefix_tree_t *tree, const char *input, int skip_levels, gboo
else {
/* Create new tree */
prefix = g_malloc (cur_level * sizeof (char) + 1);
- g_strlcpy (prefix, orig, cur_level + 1);
+ rspamd_strlcpy (prefix, orig, cur_level + 1);
cur->leafs[num].data = g_tree_new_full (compare_prefixes, NULL, g_free, NULL);
g_tree_insert (cur->leafs[num].data, prefix, GUINT_TO_POINTER (1));
return 1;
@@ -90,7 +90,7 @@ add_string_common (prefix_tree_t *tree, const char *input, int skip_levels, gboo
}
else {
/* Got some node, so check it */
- g_strlcpy (tmp, orig, MIN (sizeof (tmp), cur_level + 1));
+ rspamd_strlcpy (tmp, orig, MIN (sizeof (tmp), cur_level + 1));
if ((res = (uintptr_t)g_tree_lookup (cur->leafs[num].data, tmp)) != 0) {
if (! read_only) {
g_tree_insert (cur->leafs[num].data, g_strdup (tmp), GUINT_TO_POINTER (res + 1));
diff --git a/src/plugins/custom/regmark/regmark.c b/src/plugins/custom/regmark/regmark.c
index b28c07183..3b0e50903 100644
--- a/src/plugins/custom/regmark/regmark.c
+++ b/src/plugins/custom/regmark/regmark.c
@@ -141,7 +141,7 @@ parse_line (const char *line, size_t len, char **output, void *user_data)
while (p - line <= len) {
if (g_ascii_isspace (*p) || p - line == len) {
name = g_malloc (p - line + 1);
- g_strlcpy (name, line, p - line + 1);
+ rspamd_strlcpy (name, line, p - line + 1);
if (metaphone (name, 0, &metaname)) {
/* Skip spaces */
while (p - line <= len && g_ascii_isspace (*p)) {