From 274e0eebbc0bc88a0c87512843536a331aa2d168 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 4 Mar 2019 15:48:14 +0000 Subject: [PATCH] [Fix] Fix deletion of the duplicate headers --- src/libserver/milter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libserver/milter.c b/src/libserver/milter.c index 91e87c061..236a4bf75 100644 --- a/src/libserver/milter.c +++ b/src/libserver/milter.c @@ -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); -- 2.39.5