commit 895d678: [Minor] Some small style fixes
Vsevolod Stakhov
vsevolod at highsecure.ru
Wed Sep 25 16:21:05 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-09-25 17:17:19 +0100
URL: https://github.com/rspamd/rspamd/commit/895d678b90f1e957154bace185e1310f77e6cf66 (HEAD -> master)
[Minor] Some small style fixes
---
src/libmime/mime_headers.c | 6 +++---
src/libutil/str_util.h | 2 +-
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
More information about the Commits
mailing list