diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-08-12 18:35:59 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-08-12 18:35:59 +0100 |
commit | 80cb19900c3ab36faf92060ea639bccdcda5eaa9 (patch) | |
tree | 8158c05411a9ff538535ee50b47454214a644170 /src/libutil | |
parent | 74b182e0166abe108a374495079c2e23cdaceac6 (diff) | |
download | rspamd-80cb19900c3ab36faf92060ea639bccdcda5eaa9.tar.gz rspamd-80cb19900c3ab36faf92060ea639bccdcda5eaa9.zip |
[Minor] Fix some ubsan related issues
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/str_util.c | 6 | ||||
-rw-r--r-- | src/libutil/uthash_strcase.h | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c index 962ed1871..1f2c4629f 100644 --- a/src/libutil/str_util.c +++ b/src/libutil/str_util.c @@ -255,7 +255,7 @@ rspamd_strcase_hash (gconstpointer key) len = strlen (p); - return rspamd_icase_hash (p, len, rspamd_hash_seed ()); + return (guint)rspamd_icase_hash (p, len, rspamd_hash_seed ()); } guint @@ -293,7 +293,7 @@ rspamd_ftok_icase_hash (gconstpointer key) { const rspamd_ftok_t *f = key; - return rspamd_icase_hash (f->begin, f->len, rspamd_hash_seed ()); + return (guint)rspamd_icase_hash (f->begin, f->len, rspamd_hash_seed ()); } gboolean @@ -791,7 +791,7 @@ while (0) cols = 0; while (inlen > 6) { - n = *(guint64 *)in; + memcpy (&n, in, sizeof (n)); n = GUINT64_TO_BE (n); if (str_len <= 0 || cols <= str_len - 8) { diff --git a/src/libutil/uthash_strcase.h b/src/libutil/uthash_strcase.h index 5d6f2773c..a4418b442 100644 --- a/src/libutil/uthash_strcase.h +++ b/src/libutil/uthash_strcase.h @@ -26,7 +26,7 @@ /* Utils for uthash tuning */ #ifndef HASH_CASELESS #define HASH_FUNCTION(key,keylen,num_bkts,hashv,bkt) do {\ - hashv = rspamd_cryptobox_fast_hash(key, keylen, rspamd_hash_seed ()); \ + hashv = (__typeof (hashv))rspamd_cryptobox_fast_hash(key, keylen, rspamd_hash_seed ()); \ bkt = (hashv) & (num_bkts-1); \ } while (0) @@ -78,7 +78,7 @@ rspamd_cryptobox_fast_hash_update (&_hst, &_u, sizeof (_u)); \ break; \ } \ - hashv = rspamd_cryptobox_fast_hash_final (&_hst); \ + hashv = (__typeof (hashv))rspamd_cryptobox_fast_hash_final (&_hst); \ bkt = (hashv) & (num_bkts-1); \ } while (0) #define HASH_KEYCMP(a,b,len) rspamd_lc_cmp(a,b,len) |