]> source.dussan.org Git - rspamd.git/commitdiff
Assume empty input as failed scan
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 14 Dec 2015 13:08:14 +0000 (13:08 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 14 Dec 2015 13:08:14 +0000 (13:08 +0000)
src/libserver/re_cache.c

index 95d64edf94b2941270e9eb4585d6a758b7209215..63af03202cbb4e010ea3fa6ffedd94d946ca1150 100644 (file)
@@ -529,12 +529,19 @@ rspamd_re_cache_process_regexp_data (struct rspamd_re_runtime *rt,
        struct rspamd_re_cache_elt *elt;
        struct rspamd_re_class *re_class;
        guint64 re_id;
-       guint ret;
+       guint ret = 0;
 
        re_id = rspamd_regexp_get_cache_id (re);
        elt = g_ptr_array_index (rt->cache->re, re_id);
        re_class = rspamd_regexp_get_class (re);
 
+       if (len == 0 || in == NULL) {
+               /* We assume this as absence of the specified data */
+               setbit (rt->checked, re_id);
+               rt->results[re_id] = ret;
+               return ret;
+       }
+
 #ifndef WITH_HYPERSCAN
        ret = rspamd_re_cache_process_pcre (rt, re, in, len, is_raw);
        setbit (rt->checked, re_id);
@@ -548,10 +555,6 @@ rspamd_re_cache_process_regexp_data (struct rspamd_re_runtime *rt,
                rt->results[re_id] = ret;
        }
        else {
-               if (len == 0) {
-                       len = strlen (in);
-               }
-
                if (rt->cache->max_re_data > 0 && len > rt->cache->max_re_data) {
                        len = rt->cache->max_re_data;
                }