From: Vsevolod Stakhov Date: Wed, 25 Sep 2019 16:17:19 +0000 (+0100) Subject: [Minor] Some small style fixes X-Git-Tag: 2.0~124 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=895d678b90f1e957154bace185e1310f77e6cf66;p=rspamd.git [Minor] Some small style fixes --- diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c index f1bea0d61..a93a4ffd0 100644 --- a/src/libmime/mime_headers.c +++ b/src/libmime/mime_headers.c @@ -444,7 +444,7 @@ rspamd_mime_headers_process (struct rspamd_task *task, /* Fail state, skip line */ if (*p == '\r') { - if (*(p + 1) == '\n') { + if (p + 1 < end && *(p + 1) == '\n') { nlines_count[RSPAMD_TASK_NEWLINES_CRLF] ++; p++; } @@ -454,7 +454,7 @@ rspamd_mime_headers_process (struct rspamd_task *task, else if (*p == '\n') { nlines_count[RSPAMD_TASK_NEWLINES_LF] ++; - if (*(p + 1) == '\r') { + if (p + 1 < end && *(p + 1) == '\r') { p++; } p++; @@ -480,7 +480,7 @@ rspamd_mime_headers_process (struct rspamd_task *task, rspamd_cryptobox_hash_state_t hs; guchar hout[rspamd_cryptobox_HASHBYTES], *hexout; - for (gint i = 0; i < RSPAMD_TASK_NEWLINES_MAX; i ++) { + for (gint i = RSPAMD_TASK_NEWLINES_CR; i < RSPAMD_TASK_NEWLINES_MAX; i ++) { if (nlines_count[i] > max_cnt) { max_cnt = nlines_count[i]; sel = i; diff --git a/src/libutil/str_util.h b/src/libutil/str_util.h index 02e0ade45..50387814c 100644 --- a/src/libutil/str_util.h +++ b/src/libutil/str_util.h @@ -27,7 +27,7 @@ extern "C" { #endif enum rspamd_newlines_type { - RSPAMD_TASK_NEWLINES_CR, + RSPAMD_TASK_NEWLINES_CR = 0, RSPAMD_TASK_NEWLINES_LF, RSPAMD_TASK_NEWLINES_CRLF, RSPAMD_TASK_NEWLINES_MAX