diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-17 14:20:05 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-17 14:20:05 +0000 |
commit | 3f5511c9b11dadd45f57bb43ef1162037c11c77c (patch) | |
tree | 1ba4c3bd096042d201f221449944d2a0546df7b3 /src | |
parent | caf418acf6db08f8c259611ea8601835ddb84d32 (diff) | |
download | rspamd-3f5511c9b11dadd45f57bb43ef1162037c11c77c.tar.gz rspamd-3f5511c9b11dadd45f57bb43ef1162037c11c77c.zip |
[CritFix] Fix lowercase comparison
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/str_util.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c index c111b0a96..570f9a948 100644 --- a/src/libutil/str_util.c +++ b/src/libutil/str_util.c @@ -79,10 +79,10 @@ rspamd_str_lc (gchar *str, guint size) switch (leftover) { case 3: *dest++ = lc_map[(guchar)str[i++]]; - /* falltrough */ + /* FALLTHRU */ case 2: *dest++ = lc_map[(guchar)str[i++]]; - /* falltrough */ + /* FALLTHRU */ case 1: *dest = lc_map[(guchar)str[i]]; } @@ -122,13 +122,12 @@ rspamd_lc_cmp (const gchar *s, const gchar *d, gsize l) } while (leftover > 0) { - if (g_ascii_tolower (*s) != g_ascii_tolower (*d)) { - return (*s) - (*d); + if (g_ascii_tolower (s[i]) != g_ascii_tolower (d[i])) { + return s[i] - d[i]; } leftover--; - s++; - d++; + i++; } return ret; @@ -221,17 +220,17 @@ rspamd_icase_hash (const gchar *in, gsize len, guint64 seed) switch (leftover) { case 7: - u.c.c7 = lc_map[(guchar)s[i++]]; /* fallthrough */ + u.c.c7 = lc_map[(guchar)s[i++]]; /* FALLTHRU */ case 6: - u.c.c6 = lc_map[(guchar)s[i++]]; /* fallthrough */ + u.c.c6 = lc_map[(guchar)s[i++]]; /* FALLTHRU */ case 5: - u.c.c5 = lc_map[(guchar)s[i++]]; /* fallthrough */ + u.c.c5 = lc_map[(guchar)s[i++]]; /* FALLTHRU */ case 4: - u.c.c4 = lc_map[(guchar)s[i++]]; /* fallthrough */ + u.c.c4 = lc_map[(guchar)s[i++]]; /* FALLTHRU */ case 3: - u.c.c3 = lc_map[(guchar)s[i++]]; /* fallthrough */ + u.c.c3 = lc_map[(guchar)s[i++]]; /* FALLTHRU */ case 2: - u.c.c2 = lc_map[(guchar)s[i++]]; /* fallthrough */ + u.c.c2 = lc_map[(guchar)s[i++]]; /* FALLTHRU */ case 1: u.c.c1 = lc_map[(guchar)s[i]]; break; |