aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-25 17:17:19 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-25 17:17:19 +0100
commit895d678b90f1e957154bace185e1310f77e6cf66 (patch)
tree57bdb274a24e0d0e9c52644223f6d6aa9d911268
parentc8eb8b4eea971c5b00e02e3e0cb16c8987a76b93 (diff)
downloadrspamd-895d678b90f1e957154bace185e1310f77e6cf66.tar.gz
rspamd-895d678b90f1e957154bace185e1310f77e6cf66.zip
[Minor] Some small style fixes
-rw-r--r--src/libmime/mime_headers.c6
-rw-r--r--src/libutil/str_util.h2
2 files changed, 4 insertions, 4 deletions
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