diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-05-29 15:18:55 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-05-29 15:18:55 +0100 |
commit | dc2447bb6f940a72aedf9761598470f24a822d79 (patch) | |
tree | 1a921041e777d0429cde3b6f70cceea7c20ca169 /src/libserver | |
parent | 23c32545f5853aac316fe9c28ec08d6b70231d3e (diff) | |
download | rspamd-dc2447bb6f940a72aedf9761598470f24a822d79.tar.gz rspamd-dc2447bb6f940a72aedf9761598470f24a822d79.zip |
[Minor] Some fixes to allow empty symbols_enabled/disabled
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/rspamd_symcache.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libserver/rspamd_symcache.c b/src/libserver/rspamd_symcache.c index 0bd68fca6..624d1c382 100644 --- a/src/libserver/rspamd_symcache.c +++ b/src/libserver/rspamd_symcache.c @@ -3531,10 +3531,8 @@ rspamd_symcache_get_forbidden_settings_ids (struct rspamd_symcache *cache, return item->allowed_ids.dyn.n; } else { - while (item->forbidden_ids.st[cnt] != 0) { + while (item->forbidden_ids.st[cnt] != 0 && cnt < G_N_ELEMENTS (item->allowed_ids.st)) { cnt ++; - - g_assert (cnt < G_N_ELEMENTS (item->allowed_ids.st)); } *nids = cnt; @@ -3543,7 +3541,7 @@ rspamd_symcache_get_forbidden_settings_ids (struct rspamd_symcache *cache, } } -/* Usable for near-sorted ids list */ +/* Insertion sort: usable for near-sorted ids list */ static inline void rspamd_ids_insertion_sort (guint *a, guint n) { @@ -3571,7 +3569,7 @@ rspamd_symcache_add_id_to_list (rspamd_mempool_t *pool, if (ls->st[0] == -1) { /* Dynamic array */ if (ls->dyn.len < ls->dyn.allocated) { - /* Trivial, append + qsort */ + /* Trivial, append + sort */ ls->dyn.n[ls->dyn.len++] = id; } else { @@ -3590,7 +3588,7 @@ rspamd_symcache_add_id_to_list (rspamd_mempool_t *pool, } else { /* Static part */ - while (ls->st[cnt] != 0) { + while (ls->st[cnt] != 0 && cnt < G_N_ELEMENTS (ls->st)) { cnt ++; } |