aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-09-29 20:48:26 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-09-29 20:48:53 +0100
commit32e5b11adfc3550bd4dfe50c3aaa2e96900af102 (patch)
tree1b4e2e5665e90c6ed712d7cc7665923ef1686c3c
parent2973bb01290b5efe8f373ba8990ad10c2ec025ae (diff)
downloadrspamd-32e5b11adfc3550bd4dfe50c3aaa2e96900af102.tar.gz
rspamd-32e5b11adfc3550bd4dfe50c3aaa2e96900af102.zip
[Fix] Fix endless loop if broken arc chain has been found
-rw-r--r--src/libserver/dkim.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index bd1854d5d..27db77c26 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -2342,13 +2342,18 @@ rspamd_dkim_canonize_header (struct rspamd_dkim_common_ctx *ctx,
id_len = rspamd_snprintf (idx_buf, sizeof (idx_buf), "i=%d;",
count);
- for (cur = rh->prev;; cur = cur->prev) {
+ for (cur = rh->prev; ; cur = cur->prev) {
if (cur->decoded &&
rspamd_substring_search (cur->decoded, strlen (cur->decoded),
idx_buf, id_len) != -1) {
sel = cur;
break;
}
+
+ if (cur == rh) {
+ /* Cycle */
+ break;
+ }
}
if (sel == NULL) {