diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-11-21 14:47:19 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-11-21 14:47:19 +0000 |
commit | a16bea0e74b6bd17f54cf296cf1807a1e83ab2da (patch) | |
tree | 6b2d44b6fb2fc993a48772da93faeb3889932cdb /src/fuzzy_storage.c | |
parent | f3c299ded9fa25e1c5c60c596515e99c386d5d55 (diff) | |
download | rspamd-a16bea0e74b6bd17f54cf296cf1807a1e83ab2da.tar.gz rspamd-a16bea0e74b6bd17f54cf296cf1807a1e83ab2da.zip |
[Fix] Fix overflow in fuzzy_stats command
Diffstat (limited to 'src/fuzzy_storage.c')
-rw-r--r-- | src/fuzzy_storage.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index b8ee95c15..99d2ef1a1 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -1333,8 +1333,9 @@ rspamd_fuzzy_process_command(struct fuzzy_session *session) } else if (cmd->cmd == FUZZY_STAT) { result.v1.prob = 1.0f; - result.v1.value = 0; - result.v1.flag = session->ctx->stat.fuzzy_hashes; + /* Store high qword in value and low qword in flag */ + result.v1.value = (gint32) ((guint64) session->ctx->stat.fuzzy_hashes >> 32); + result.v1.flag = session->ctx->stat.fuzzy_hashes & G_MAXUINT32; rspamd_fuzzy_make_reply(cmd, &result, session, send_flags); } else if (cmd->cmd == FUZZY_PING) { |