]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix some corner cases of folding
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 29 Mar 2017 23:09:16 +0000 (00:09 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 29 Mar 2017 23:09:16 +0000 (00:09 +0100)
src/libutil/str_util.c

index 10f5d54e39b0ea119ae8842dcd5f238f274490d2..cb110e13626beedc36d6197662c0b70a8a3f339e 100644 (file)
@@ -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;