commit a16bea0: [Fix] Fix overflow in fuzzy_stats command
Vsevolod Stakhov
vsevolod at rspamd.com
Mon Jul 29 17:49:09 UTC 2024
Author: Vsevolod Stakhov
Date: 2023-11-21 14:47:19 +0000
URL: https://github.com/rspamd/rspamd/commit/a16bea0e74b6bd17f54cf296cf1807a1e83ab2da
[Fix] Fix overflow in fuzzy_stats command
---
src/fuzzy_storage.c | 5 +++--
1 file 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) {
More information about the Commits
mailing list