aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/str_util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-09 16:03:06 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-09 16:03:06 +0100
commit259cab02423faae0435695bc39e169b696b3d1fd (patch)
treedefe75b5bb926bfc199b7171c65eb1803ca31071 /src/libutil/str_util.c
parent983883f45b57c8772256c68d6dbd51539f80e654 (diff)
downloadrspamd-259cab02423faae0435695bc39e169b696b3d1fd.tar.gz
rspamd-259cab02423faae0435695bc39e169b696b3d1fd.zip
Allow to change fold_max variable.
Diffstat (limited to 'src/libutil/str_util.c')
-rw-r--r--src/libutil/str_util.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c
index 844962c25..2203cf0d4 100644
--- a/src/libutil/str_util.c
+++ b/src/libutil/str_util.c
@@ -865,10 +865,12 @@ rspamd_strings_levenshtein_distance (const gchar *s1, gsize s1len,
}
GString *
-rspamd_header_value_fold (const gchar *name, const gchar *value)
+rspamd_header_value_fold (const gchar *name,
+ const gchar *value,
+ guint fold_max)
{
GString *res;
- const guint fold_max = 76;
+ const guint default_fold_max = 76;
guint cur_len;
const gchar *p, *c;
gboolean first_token = TRUE;
@@ -886,6 +888,11 @@ rspamd_header_value_fold (const gchar *name, const gchar *value)
g_assert (name != NULL);
g_assert (value != NULL);
+ /* Filter insane values */
+ if (fold_max < 20) {
+ fold_max = default_fold_max;
+ }
+
res = g_string_sized_new (strlen (value));
c = value;