]> source.dussan.org Git - rspamd.git/commitdiff
Fix broken headers and task:has_flag
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 22 Jan 2016 17:09:15 +0000 (17:09 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 22 Jan 2016 17:09:15 +0000 (17:09 +0000)
src/libmime/message.c
src/lua/lua_task.c

index da34ac9cabf97d682d1966beae6b3776834fd1ad..a7a5a86b84e7b3cb1dcffa14fd16c8c5e4087375 100644 (file)
@@ -424,7 +424,7 @@ process_raw_headers (struct rspamd_task *task, GHashTable *target,
        end = p + len;
        c = p;
 
-       while (p <= end) {
+       while (p < end) {
                /* FSM for processing headers */
                switch (state) {
                case 0:
@@ -457,6 +457,7 @@ process_raw_headers (struct rspamd_task *task, GHashTable *target,
                        }
                        else if (g_ascii_isspace (*p)) {
                                /* Not header but some garbage */
+                               task->flags |= RSPAMD_TASK_FLAG_BROKEN_HEADERS;
                                state = 100;
                                next_state = 0;
                        }
@@ -598,7 +599,6 @@ process_raw_headers (struct rspamd_task *task, GHashTable *target,
                        break;
                case 100:
                        /* Fail state, skip line */
-                       task->flags |= RSPAMD_TASK_FLAG_BROKEN_HEADERS;
 
                        if (*p == '\r') {
                                if (*(p + 1) == '\n') {
index 22631234e8f241a0b7c0a2444406d11fca0c3e43..e4689c4832aa84a9e816238f76775845c6a33f6e 100644 (file)
@@ -1948,10 +1948,11 @@ lua_task_has_flag (lua_State *L)
 
                if (!found) {
                        msg_warn_task ("unknown flag requested: %s", flag);
+                       lua_pushboolean (L, 0);
                }
        }
 
-       return 0;
+       return 1;
 }
 
 static gint