]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Some small style fixes
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Sep 2019 16:17:19 +0000 (17:17 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Sep 2019 16:17:19 +0000 (17:17 +0100)
src/libmime/mime_headers.c
src/libutil/str_util.h

index f1bea0d615d7265ed0844df8b8334e5a48d073b4..a93a4ffd0d79e0d9f9c2d1a8becfbda54283d0b1 100644 (file)
@@ -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;
index 02e0ade4528cf495014be79429d634db13766376..50387814c7666669ceb87c4920e5a6bf47ae54b7 100644 (file)
@@ -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