]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix deletion of the duplicate headers
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 4 Mar 2019 15:48:14 +0000 (15:48 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 4 Mar 2019 15:48:14 +0000 (15:48 +0000)
src/libserver/milter.c

index 91e87c06133e1377d2c44ebe707a5ea21c14b25c..236a4bf750a05195339ad60491b67ae5d0d16b2c 100644 (file)
@@ -1544,9 +1544,9 @@ rspamd_milter_remove_header_safe (struct rspamd_milter_session *session,
                                        RSPAMD_MILTER_CHGHEADER,
                                        nhdr, hname, hvalue);
                }
-               else if (nhdr == 0) {
+               else if (nhdr == 0 && ar->len > 0) {
                        /* We need to clear all headers */
-                       for (i = 1; i <= ar->len; i ++) {
+                       for (i = ar->len; i > 0; i --) {
                                rspamd_milter_send_action (session,
                                                RSPAMD_MILTER_CHGHEADER,
                                                i, hname, hvalue);