From: Vsevolod Stakhov Date: Wed, 29 Mar 2017 23:09:16 +0000 (+0100) Subject: [Minor] Fix some corner cases of folding X-Git-Tag: 1.5.5~83 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4d9ab00d0cd84ad2ae9937a2e3aa8bea41146d6e;p=rspamd.git [Minor] Fix some corner cases of folding --- diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c index 10f5d54e3..cb110e136 100644 --- a/src/libutil/str_util.c +++ b/src/libutil/str_util.c @@ -1092,7 +1092,6 @@ 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 ++; @@ -1111,8 +1110,13 @@ rspamd_header_value_fold (const gchar *name, break; } - g_string_append_len (res, c, p - c); - cur_len = p - c; + if (p > c) { + g_string_append_len (res, c, p - c); + cur_len = p - c; + } + else { + cur_len = 0; + } } first_token = TRUE;