From: Vsevolod Stakhov Date: Tue, 14 Aug 2012 13:27:32 +0000 (+0400) Subject: Fix relaxed body canonization algorithm for several complex cases. X-Git-Tag: 0.5.2~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ab9580bdd74e787b943954f7ff1e8bca9c37ff0a;p=rspamd.git Fix relaxed body canonization algorithm for several complex cases. --- diff --git a/src/dkim.c b/src/dkim.c index cc45f28a3..d042f3f7a 100644 --- a/src/dkim.c +++ b/src/dkim.c @@ -854,6 +854,10 @@ rspamd_dkim_relaxed_body_step (GChecksum *ck, const gchar **start, guint remain) *start = h; + if (!finished && *(t - 1) == ' ' && g_ascii_isspace (*h)) { + /* Avoid border problems */ + t --; + } #if 0 msg_debug ("update signature with buffer: %*s", t - buf, buf); #endif @@ -875,6 +879,12 @@ rspamd_dkim_canonize_body (rspamd_dkim_context_t *ctx, const gchar *start, const if (*end == '\n' && *(end - 1) == '\r' && *(end - 2) == '\n') { end -= 2; } + else if (*end == '\n' && *(end - 1) == '\n') { + end --; + } + else if (*end == '\r' && *(end - 1) == '\r') { + end --; + } else { break; }