]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Also strip spaces at the last parameter
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 8 Mar 2019 15:29:21 +0000 (15:29 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 8 Mar 2019 15:29:21 +0000 (15:29 +0000)
src/libserver/dkim.c

index 8f41d6220fb5649b7835f5cdf916e8946a9ed6a0..9692d1b932f1b7a686baa25e708c7db684bb9c20 100644 (file)
@@ -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++;
                                }