summaryrefslogtreecommitdiffstats
path: root/src/expressions.c
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/expressions.c
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/expressions.c')
-rw-r--r--src/expressions.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/expressions.c b/src/expressions.c
index 1f83c2827..21409c81e 100644
--- a/src/expressions.c
+++ b/src/expressions.c
@@ -419,7 +419,7 @@ parse_expression (memory_pool_t * pool, gchar *line)
p++;
}
str = memory_pool_alloc (pool, p - c + 2);
- g_strlcpy (str, c - 1, (p - c + 2));
+ rspamd_strlcpy (str, c - 1, (p - c + 2));
g_strstrip (str);
msg_debug ("found regexp: %s", str);
if (strlen (str) > 0) {
@@ -445,7 +445,7 @@ parse_expression (memory_pool_t * pool, gchar *line)
func = memory_pool_alloc (pool, sizeof (struct expression_function));
func->name = memory_pool_alloc (pool, p - c + 1);
func->args = NULL;
- g_strlcpy (func->name, c, (p - c + 1));
+ rspamd_strlcpy (func->name, c, (p - c + 1));
g_strstrip (func->name);
state = READ_FUNCTION_ARGUMENT;
g_queue_push_tail (function_stack, func);
@@ -456,7 +456,7 @@ parse_expression (memory_pool_t * pool, gchar *line)
/* In fact it is not function, but symbol */
if (c != p) {
str = memory_pool_alloc (pool, p - c + 1);
- g_strlcpy (str, c, (p - c + 1));
+ rspamd_strlcpy (str, c, (p - c + 1));
g_strstrip (str);
if (strlen (str) > 0) {
insert_expression (pool, &expr, EXPR_STR, 0, str, copy);
@@ -469,7 +469,7 @@ parse_expression (memory_pool_t * pool, gchar *line)
p++;
if (c != p) {
str = memory_pool_alloc (pool, p - c + 1);
- g_strlcpy (str, c, (p - c + 1));
+ rspamd_strlcpy (str, c, (p - c + 1));
g_strstrip (str);
if (strlen (str) > 0) {
insert_expression (pool, &expr, EXPR_STR, 0, str, copy);
@@ -492,7 +492,7 @@ parse_expression (memory_pool_t * pool, gchar *line)
if (*p == ',' || (*p == ')' && brackets == 0)) {
arg = NULL;
str = memory_pool_alloc (pool, p - c + 1);
- g_strlcpy (str, c, (p - c + 1));
+ rspamd_strlcpy (str, c, (p - c + 1));
g_strstrip (str);
/* Recursive call */
arg = maybe_parse_expression (pool, str);