commit 752d619: [Minor] Fix several issues

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Feb 23 21:14:13 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-02-23 21:08:42 +0000
URL: https://github.com/rspamd/rspamd/commit/752d619ceb5d0fb9d4e938e4f8f346ad2c1f3629 (HEAD -> master)

[Minor] Fix several issues

---
 src/libmime/mime_headers.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c
index 1677bb349..9137e29de 100644
--- a/src/libmime/mime_headers.c
+++ b/src/libmime/mime_headers.c
@@ -1842,8 +1842,8 @@ rspamd_message_set_modified_header (struct rspamd_task *task,
 		 * This implies an additional copy of all structures but is safe enough to
 		 * deal with it
 		 */
-		cur_hdr->flags |= RSPAMD_HEADER_MODIFIED;
-		cur_hdr->modified_chain = NULL;
+		hdr_elt->flags |= RSPAMD_HEADER_MODIFIED;
+		hdr_elt->modified_chain = NULL;
 		gint new_chain_length = 0;
 
 		PTR_ARRAY_FOREACH (existing_ar, i, cur_hdr) {
@@ -1856,7 +1856,7 @@ rspamd_message_set_modified_header (struct rspamd_task *task,
 				nhdr->next = NULL;
 				nhdr->ord_next = NULL;
 
-				DL_APPEND (cur_hdr->modified_chain, nhdr);
+				DL_APPEND (hdr_elt->modified_chain, nhdr);
 				new_chain_length ++;
 			}
 		}
@@ -1924,13 +1924,13 @@ rspamd_message_set_modified_header (struct rspamd_task *task,
 						DL_APPEND (hdr_elt->modified_chain, nhdr);
 					}
 					else if (ord > 0) {
-						while (ord > 0 && (*pos) && (*pos)->next) {
+						while (ord > 0 && (*pos)) {
 							ord --;
 							pos = &((*pos)->next);
 						}
 						if (*pos) {
 							/* pos is &(elt)->next */
-							nhdr->next = (*pos)->next;
+							nhdr->next = (*pos);
 							nhdr->prev = (*pos)->prev;
 							(*pos)->prev = nhdr;
 							*pos = nhdr;


More information about the Commits mailing list