From: Vsevolod Stakhov Date: Fri, 17 Sep 2021 20:55:43 +0000 (+0100) Subject: [Minor] Do not read extra byte of garbadge X-Git-Tag: 3.1~150 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fe7b62b33dbb2387158510f22c549dd0f9e5c93;p=thirdparty%2Frspamd.git [Minor] Do not read extra byte of garbadge Found by: coverity scan --- diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c index f8c81cb93a..3298c7bed9 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; }