commit 4fe7b62: [Minor] Do not read extra byte of garbadge

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Sep 17 21:00:06 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-09-17 21:55:43 +0100
URL: https://github.com/rspamd/rspamd/commit/4fe7b62b33dbb2387158510f22c549dd0f9e5c93 (HEAD -> master)

[Minor] Do not read extra byte of garbadge
Found by: coverity scan

---
 src/lua/lua_url.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c
index f8c81cb93..3298c7bed 100644
--- a/src/lua/lua_url.c
+++ b/src/lua/lua_url.c
@@ -1336,7 +1336,7 @@ lua_url_cbdata_dtor (struct lua_tree_cb_data *cbd)
 
 gsize
 lua_url_adjust_skip_prob (gdouble timestamp,
-						  guchar *digest,
+						  guchar digest[16],
 						  struct lua_tree_cb_data *cb,
 						  gsize sz)
 {
@@ -1346,10 +1346,10 @@ lua_url_adjust_skip_prob (gdouble timestamp,
 		 * Use task dependent probabilistic seed to ensure that
 		 * consequent task:get_urls return the same list of urls
 		 */
+		memset (cb->xoroshiro_state, 0, sizeof (cb->xoroshiro_state));
 		memcpy (&cb->xoroshiro_state[0], &timestamp,
 				MIN (sizeof (cb->xoroshiro_state[0]), sizeof (timestamp)));
-		memcpy (&cb->xoroshiro_state[1], digest,
-				sizeof (cb->xoroshiro_state[1]) * 3);
+		memcpy (&cb->xoroshiro_state[1], digest, 16);
 		sz = cb->max_urls;
 	}
 


More information about the Commits mailing list