aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstat')
-rw-r--r--src/libstat/backends/redis_backend.c7
-rw-r--r--src/libstat/learn_cache/redis_cache.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c
index f191dc974..121162fc8 100644
--- a/src/libstat/backends/redis_backend.c
+++ b/src/libstat/backends/redis_backend.c
@@ -1256,7 +1256,12 @@ rspamd_redis_try_ucl (struct redis_stat_ctx *backend,
elt = ucl_object_lookup_any (obj, "db", "database", "dbname", NULL);
if (elt) {
- backend->dbname = ucl_object_tostring (elt);
+ if (ucl_object_type (elt) == UCL_STRING) {
+ backend->dbname = ucl_object_tostring (elt);
+ }
+ else if (ucl_object_type (elt) == UCL_INT) {
+ backend->dbname = ucl_object_tostring_forced (elt);
+ }
}
else {
backend->dbname = NULL;
diff --git a/src/libstat/learn_cache/redis_cache.c b/src/libstat/learn_cache/redis_cache.c
index b7ba71f4b..c3f4c6598 100644
--- a/src/libstat/learn_cache/redis_cache.c
+++ b/src/libstat/learn_cache/redis_cache.c
@@ -274,7 +274,12 @@ rspamd_redis_cache_try_ucl (struct rspamd_redis_cache_ctx *cache_ctx,
elt = ucl_object_lookup_any (obj, "db", "database", "dbname", NULL);
if (elt) {
- cache_ctx->dbname = ucl_object_tostring (elt);
+ if (ucl_object_type (elt) == UCL_STRING) {
+ cache_ctx->dbname = ucl_object_tostring (elt);
+ }
+ else if (ucl_object_type (elt) == UCL_INT) {
+ cache_ctx->dbname = ucl_object_tostring_forced (elt);
+ }
}
else {
cache_ctx->dbname = NULL;