aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libserver/milter.c4
1 files 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);