aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libmime/message.c10
-rw-r--r--src/libserver/url.c2
-rw-r--r--src/libutil/addr.c7
-rw-r--r--src/lua/lua_task.c2
4 files changed, 15 insertions, 6 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index 333748d16..7c0429c3c 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -835,9 +835,13 @@ rspamd_message_process_text_part (struct rspamd_task *task,
task->result = mres;
task->pre_result.action = act;
task->pre_result.str = "Gtube pattern";
- ucl_object_insert_key (task->messages,
- ucl_object_fromstring ("Gtube pattern"), "smtp_message", 0,
- false);
+
+ if (ucl_object_lookup (task->messages, "smtp_message") == NULL) {
+ ucl_object_replace_key (task->messages,
+ ucl_object_fromstring ("Gtube pattern"), "smtp_message", 0,
+ false);
+ }
+
rspamd_task_insert_result (task, GTUBE_SYMBOL, 0, NULL);
return;
diff --git a/src/libserver/url.c b/src/libserver/url.c
index 019a4ff36..653cc3570 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -1652,7 +1652,7 @@ rspamd_url_parse (struct rspamd_url *uri, gchar *uristring, gsize len,
memcpy (uri->string + u.field_data[UF_SCHEMA].len, "://", 3);
rspamd_strlcpy (uri->string + u.field_data[UF_SCHEMA].len + 3,
p + u.field_data[UF_SCHEMA].len + 1,
- len - 1 - u.field_data[UF_SCHEMA].len);
+ len - 2 - u.field_data[UF_SCHEMA].len);
/* Compensate slashes added */
for (i = UF_SCHEMA + 1; i < UF_MAX; i++) {
if (u.field_set & (1 << i)) {
diff --git a/src/libutil/addr.c b/src/libutil/addr.c
index ce97e486c..a6f1adaf8 100644
--- a/src/libutil/addr.c
+++ b/src/libutil/addr.c
@@ -493,7 +493,7 @@ gboolean
rspamd_parse_inet_address_ip6 (const guchar *text, gsize len, gpointer target)
{
guchar t, *zero = NULL, *s, *d, *addr = target;
- const guchar *p, *digit = NULL;
+ const guchar *p, *digit = NULL, *percent;
gsize len4 = 0;
guint n = 8, nibbles = 0, word = 0;
@@ -513,6 +513,11 @@ rspamd_parse_inet_address_ip6 (const guchar *text, gsize len, gpointer target)
p = text;
}
+ /* Check IPv6 scope */
+ if ((percent = memchr (p, '%', len)) != NULL && percent > p) {
+ len = percent - p; /* Ignore scope */
+ }
+
for (/* void */; len; len--) {
t = *p++;
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 0b999d89e..e11a982cd 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -1576,7 +1576,7 @@ lua_task_set_pre_result (lua_State * L)
action_str = rspamd_mempool_strdup (task->task_pool,
luaL_checkstring (L, 3));
task->pre_result.str = action_str;
- ucl_object_insert_key (task->messages,
+ ucl_object_replace_key (task->messages,
ucl_object_fromstring (action_str), "smtp_message", 0,
false);
}