Browse Source

[Fix] Fix folding algorithm to deal with empty tokens

tags/1.4.0
Vsevolod Stakhov 7 years ago
parent
commit
3fe38b2769
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      src/libutil/str_util.c

+ 5
- 3
src/libutil/str_util.c View File

@@ -1134,10 +1134,11 @@ rspamd_header_value_fold (const gchar *name,
break;
case fold_token:
/* Here, we have token start at 'c' and token end at 'p' */
g_assert (p > c);

if (fold_type == fold_after) {
g_string_append_len (res, c, p - c);

if (p > c) {
g_string_append_len (res, c, p - c);
}

switch (how) {
case RSPAMD_TASK_NEWLINES_LF:
@@ -1160,6 +1161,7 @@ rspamd_header_value_fold (const gchar *name,
cur_len = 0;
}
else {
g_assert (p > c);
/* Skip space if needed */
if (g_ascii_isspace (*c) && p > c) {
c ++;

Loading…
Cancel
Save