commit 68d4dd9: [Minor] Fix remaining octets logic

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Sep 3 12:14:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-09-03 13:10:59 +0100
URL: https://github.com/rspamd/rspamd/commit/68d4dd97f4f63d4e27d33d20fcd6c246071f8a7c (HEAD -> master)

[Minor] Fix remaining octets logic

---
 src/libserver/dkim.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index 46b4b8936..f71fd488b 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -1701,7 +1701,7 @@ rspamd_dkim_relaxed_body_step (struct rspamd_dkim_common_ctx *ctx, EVP_MD_CTX *c
 	gchar *t;
 	guint len, inlen;
 	gssize octets_remain;
-	gboolean got_sp;
+	gboolean got_sp, ret = TRUE;
 	gchar buf[1024];
 
 	len = size;
@@ -1772,6 +1772,8 @@ rspamd_dkim_relaxed_body_step (struct rspamd_dkim_common_ctx *ctx, EVP_MD_CTX *c
 			t --;
 			octets_remain ++;
 		}
+
+		ret = FALSE;
 	}
 
 	*start = h;
@@ -1785,10 +1787,9 @@ rspamd_dkim_relaxed_body_step (struct rspamd_dkim_common_ctx *ctx, EVP_MD_CTX *c
 				"(%z size, %z -> %z remain)",
 						cklen, *remain, octets_remain);
 		*remain = octets_remain;
-
 	}
 
-	return ((len != 0) && (octets_remain != 0));
+	return ret && ((len > 0) && (octets_remain > 0));
 }
 
 static gboolean


More information about the Commits mailing list