aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-11-07 17:08:41 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-11-07 17:08:41 +0000
commite921a8559ccc890c0c0c6e283e61cf6d9e24c955 (patch)
tree06be05894c92d2be2bcc5c6cf00dc2ea54534148
parentd70836c1a799962f2b25a320d72a960748b76645 (diff)
downloadrspamd-e921a8559ccc890c0c0c6e283e61cf6d9e24c955.tar.gz
rspamd-e921a8559ccc890c0c0c6e283e61cf6d9e24c955.zip
Fix processing of very short messages in DKIM.
Reported by: @citrin
-rw-r--r--src/libserver/dkim.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c
index fb355d353..3c63e7280 100644
--- a/src/libserver/dkim.c
+++ b/src/libserver/dkim.c
@@ -1047,7 +1047,7 @@ rspamd_dkim_relaxed_body_step (GChecksum *ck, const gchar **start, guint size,
t--;
}
/* Replace a single \n or \r with \r\n */
- if (*h == '\n' && h != *start && *(h - 1) != '\r') {
+ if (*h == '\n' && (h == *start || *(h - 1) != '\r')) {
*t++ = '\r';
inlen--;
added ++;
@@ -1138,7 +1138,7 @@ rspamd_dkim_simple_body_step (GChecksum *ck, const gchar **start, guint size,
while (len && inlen) {
if (*h == '\r' || *h == '\n') {
/* Replace a single \n or \r with \r\n */
- if (*h == '\n' && *(h - 1) != '\r') {
+ if (*h == '\n' && (h == *start || *(h - 1) != '\r')) {
*t++ = '\r';
added ++;
inlen--;
@@ -1212,7 +1212,7 @@ rspamd_dkim_canonize_body (rspamd_dkim_context_t *ctx,
}
}
end = p + 1;
- if (end == start || end == start + 2) {
+ if (end == start) {
/* Empty body */
if (ctx->body_canon_type == DKIM_CANON_SIMPLE) {
g_checksum_update (ctx->body_hash, CRLF, sizeof (CRLF) - 1);