commit 274e0ee: [Fix] Fix deletion of the duplicate headers

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Mar 4 18:14:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-03-04 15:48:14 +0000
URL: https://github.com/rspamd/rspamd/commit/274e0eebbc0bc88a0c87512843536a331aa2d168

[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);


More information about the Commits mailing list