diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-09-21 12:13:44 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-09-21 12:13:44 +0100 |
commit | 7fee396041bb1250086c76517c02d8471c93a40c (patch) | |
tree | 91c48f10ee17d9c21da5cdadac8dad03159c927f /src/libutil | |
parent | 077cee773330eda0b994b7b70fa1d6ec307db478 (diff) | |
download | rspamd-7fee396041bb1250086c76517c02d8471c93a40c.tar.gz rspamd-7fee396041bb1250086c76517c02d8471c93a40c.zip |
[Minor] Fix some more issues
Found by: coverity scan
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/expression.c | 4 | ||||
-rw-r--r-- | src/libutil/fstring.c | 25 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/libutil/expression.c b/src/libutil/expression.c index ad78c0fcd..ccbe66195 100644 --- a/src/libutil/expression.c +++ b/src/libutil/expression.c @@ -1183,7 +1183,9 @@ rspamd_parse_expression (const gchar *line, gsize len, return TRUE; error_label: - msg_debug_expression ("fatal error: %e", *err); + if (err && *err) { + msg_debug_expression ("fatal expression parse error: %e", *err); + } while ((tmp = rspamd_expr_stack_elt_pop (operand_stack)) != NULL) { g_node_destroy (tmp); diff --git a/src/libutil/fstring.c b/src/libutil/fstring.c index 652d72d14..3f3af5357 100644 --- a/src/libutil/fstring.c +++ b/src/libutil/fstring.c @@ -272,25 +272,22 @@ rspamd_fstrhash_lc (const rspamd_ftok_t * str, gboolean is_utf) p = str->begin; hval = str->len; + end = p + str->len; if (is_utf) { - while (end < str->begin + str->len) { - if (rspamd_fast_utf8_validate (p, str->len) != 0) { - return rspamd_fstrhash_lc (str, FALSE); - } - while (p < end) { - uc = g_unichar_tolower (g_utf8_get_char (p)); - for (j = 0; j < sizeof (gunichar); j++) { - t = (uc >> (j * 8)) & 0xff; - if (t != 0) { - hval = fstrhash_c (t, hval); - } + if (rspamd_fast_utf8_validate (p, str->len) != 0) { + return rspamd_fstrhash_lc (str, FALSE); + } + while (p < end) { + uc = g_unichar_tolower (g_utf8_get_char (p)); + for (j = 0; j < sizeof (gunichar); j++) { + t = (uc >> (j * 8)) & 0xff; + if (t != 0) { + hval = fstrhash_c (t, hval); } - p = g_utf8_next_char (p); } - p = end + 1; + p = g_utf8_next_char (p); } - } else { for (i = 0; i < str->len; i++, p++) { |