From: Vsevolod Stakhov Date: Tue, 21 Nov 2023 14:47:19 +0000 (+0000) Subject: [Fix] Fix overflow in fuzzy_stats command X-Git-Tag: 3.8.0~54^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a16bea0e74b6bd17f54cf296cf1807a1e83ab2da;p=rspamd.git [Fix] Fix overflow in fuzzy_stats command --- 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) {