commit b66b84e: [Minor] Also strip spaces at the last parameter

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Mar 8 15:35:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-03-08 15:29:21 +0000
URL: https://github.com/rspamd/rspamd/commit/b66b84e557425c7247f5cde05a334cea9e4bb571 (HEAD -> master)

[Minor] Also strip spaces at the last parameter

---
 src/libserver/dkim.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index 8f41d6220..9692d1b93 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -999,11 +999,24 @@ rspamd_create_dkim_context (const gchar *sig,
 				}
 			}
 			else if (p == end) {
-				if (param == DKIM_PARAM_UNKNOWN ||
-					!parser_funcs[param](ctx, c, p - c, err)) {
+				if (param == DKIM_PARAM_UNKNOWN) {
 					state = DKIM_STATE_ERROR;
 				}
 				else {
+					gint tlen = p - c;
+					const gchar *tmp = p - 1;
+
+					while (tlen > 0) {
+						if (!g_ascii_isspace (*tmp)) {
+							break;
+						}
+						tlen --;
+						tmp --;
+					}
+
+					if (!parser_funcs[param](ctx, c, tlen, err)) {
+						state = DKIM_STATE_ERROR;
+					}
 					/* Finish processing */
 					p++;
 				}


More information about the Commits mailing list