]> source.dussan.org Git - rspamd.git/commitdiff
[CritFix] Fix caseless comparison of equal length strings
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 28 Jul 2018 12:23:23 +0000 (13:23 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 28 Jul 2018 12:23:52 +0000 (13:23 +0100)
src/libutil/str_util.c

index 4cdae61d441fe5003afd00bb31db03979c632451..189d7a3986f2085577d4dca5a5e49440187fb0aa 100644 (file)
@@ -1388,10 +1388,7 @@ rspamd_substring_search_caseless (const gchar *in, gsize inlen,
                                rspamd_substring_casecmp_func);
        }
        else if (inlen == srchlen) {
-               return rspamd_lc_cmp (srch, in, srchlen) == 0;
-       }
-       else {
-               return (-1);
+               return rspamd_lc_cmp (srch, in, srchlen) == 0 ? 0 : (-1);
        }
 
        return (-1);