commit b689a80: [Minor] Use memcpy instead of unaligned access

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Jan 5 13:56:05 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-01-05 13:51:30 +0000
URL: https://github.com/rspamd/rspamd/commit/b689a807525232e6f0596d9360cb575e870300c2 (HEAD -> master)

[Minor] Use memcpy instead of unaligned access

---
 src/libserver/re_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c
index cde2e88a4..64f5f7a40 100644
--- a/src/libserver/re_cache.c
+++ b/src/libserver/re_cache.c
@@ -2391,7 +2391,7 @@ rspamd_re_cache_is_valid_hyperscan_file (struct rspamd_re_cache *cache,
 
 				p = map + RSPAMD_HS_MAGIC_LEN + sizeof (test_plt);
 				end = map + len;
-				n = *(gint *)p;
+				memcpy(&n, p, sizeof(n));
 				p += sizeof (gint);
 
 				if (n <= 0 || 2 * n * sizeof (gint) + /* IDs + flags */


More information about the Commits mailing list