commit d8efaee: [Minor] Fix alignment issue
Vsevolod Stakhov
vsevolod at highsecure.ru
Fri Dec 3 21:14:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-12-03 21:13:21 +0000
URL: https://github.com/rspamd/rspamd/commit/d8efaee9fe69c6c72ba53b038b39b41103be8620 (HEAD -> master)
[Minor] Fix alignment issue
---
src/libutil/str_util.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c
index 6cee32243..2d39ccf8a 100644
--- a/src/libutil/str_util.c
+++ b/src/libutil/str_util.c
@@ -3569,12 +3569,15 @@ rspamd_str_has_8bit_u64 (const guchar *beg, gsize len)
guint8 orb = 0;
if (len >= 16) {
- const guchar *nextd = beg+8;
+ const guchar *nextd = beg + sizeof(guint64);
guint64 n1 = 0, n2 = 0;
do {
- n1 |= *(const guint64 *)beg;
- n2 |= *(const guint64 *)nextd;
+ guint64 t;
+ memcpy(&t, beg, sizeof(t));
+ n1 |= t;
+ memcpy(&t, nextd, sizeof(t));
+ n2 |= t;
beg += 16;
nextd += 16;
len -= 16;
More information about the Commits
mailing list