From 4fe7b62b33dbb2387158510f22c549dd0f9e5c93 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 17 Sep 2021 21:55:43 +0100 Subject: [PATCH] [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], ×tamp, 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; } -- 2.39.5