Browse Source

[Fix] Fix processing of addresses in protocol

Issue: #723
Reported by: @leoboiko
tags/1.3.0
Vsevolod Stakhov 7 years ago
parent
commit
356f35cb07
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      src/libserver/protocol.c

+ 10
- 2
src/libserver/protocol.c View File

@@ -112,6 +112,7 @@ rspamd_protocol_escape_braces (struct rspamd_task *task, rspamd_fstring_t *in)
guint nchars = 0;
const gchar *p;
rspamd_ftok_t tok;
gboolean has_obrace = FALSE;

g_assert (in != NULL);
g_assert (in->len > 0);
@@ -119,6 +120,10 @@ rspamd_protocol_escape_braces (struct rspamd_task *task, rspamd_fstring_t *in)
p = in->str;

while ((g_ascii_isspace (*p) || *p == '<') && nchars < in->len) {
if (*p == '<') {
has_obrace = TRUE;
}

p++;
nchars ++;
}
@@ -128,12 +133,15 @@ rspamd_protocol_escape_braces (struct rspamd_task *task, rspamd_fstring_t *in)
p = in->str + in->len - 1;
tok.len = in->len - nchars;

while ((!g_ascii_isspace (*p) && *p !=
'>') && tok.len > 0) {
while (g_ascii_isspace (*p) && tok.len > 0) {
p--;
tok.len --;
}

if (has_obrace && *p == '>') {
tok.len --;
}

return rspamd_mempool_ftokdup (task->task_pool, &tok);
}


Loading…
Cancel
Save