aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/backends
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-12-14 16:46:39 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-12-14 16:46:39 +0000
commited53205a4b1e6b3eb6c13729c488e2c2459e0bbc (patch)
treedfb3d610a12762e0aa1147384e2020a8837f03fb /src/libstat/backends
parent4370851c7900b0dc90f9aa1f21d817d85c299ad5 (diff)
downloadrspamd-ed53205a4b1e6b3eb6c13729c488e2c2459e0bbc.tar.gz
rspamd-ed53205a4b1e6b3eb6c13729c488e2c2459e0bbc.zip
[Minor] Set proper size
Diffstat (limited to 'src/libstat/backends')
-rw-r--r--src/libstat/backends/redis_backend.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libstat/backends/redis_backend.cxx b/src/libstat/backends/redis_backend.cxx
index 6b3c9aae4..026bb4503 100644
--- a/src/libstat/backends/redis_backend.cxx
+++ b/src/libstat/backends/redis_backend.cxx
@@ -668,8 +668,9 @@ rspamd_redis_serialize_tokens(struct rspamd_task *task, const gchar *prefix, GPt
int i;
PTR_ARRAY_FOREACH(tokens, i, tok)
{
- char *numbuf = (char *) g_alloca(sizeof(max_int64_str) + prefix_len + 1);
- auto r = rspamd_snprintf(numbuf, sizeof(numbuf), "%s_%uL", tok->data);
+ auto numbuf_len = sizeof(max_int64_str) + prefix_len + 1;
+ auto *numbuf = (char *) g_alloca(numbuf_len);
+ auto r = rspamd_snprintf(numbuf, numbuf_len, "%s_%uL", tok->data);
*p++ = (gchar) ((r & 0xff) | 0xa0);
memcpy(p, &numbuf, r);