aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-30 00:09:16 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-30 00:09:16 +0100
commit4d9ab00d0cd84ad2ae9937a2e3aa8bea41146d6e (patch)
treede7827c2fc340aeca6bcd6acf3116d4ac233b926 /src/libutil
parentbb63c3f414e8993f6d22f527316b4c9982793da9 (diff)
downloadrspamd-4d9ab00d0cd84ad2ae9937a2e3aa8bea41146d6e.tar.gz
rspamd-4d9ab00d0cd84ad2ae9937a2e3aa8bea41146d6e.zip
[Minor] Fix some corner cases of folding
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/str_util.c10
1 files changed, 7 insertions, 3 deletions
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;