diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-15 19:24:51 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-15 19:24:51 +0000 |
commit | e0446369d13269d07cecb5711fbab7d7bc64398a (patch) | |
tree | bcd2380195721fef0e51740653c73d4b71e9ce9b /src/plugins/spf.c | |
parent | 6ffffe0d5f155aa5d212df92d97c62e2de71baa3 (diff) | |
download | rspamd-e0446369d13269d07cecb5711fbab7d7bc64398a.tar.gz rspamd-e0446369d13269d07cecb5711fbab7d7bc64398a.zip |
[Minor] Fix some outbound access issues
Found by: Coverity
Diffstat (limited to 'src/plugins/spf.c')
-rw-r--r-- | src/plugins/spf.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/spf.c b/src/plugins/spf.c index d7b76e003..e51016429 100644 --- a/src/plugins/spf.c +++ b/src/plugins/spf.c @@ -374,16 +374,16 @@ spf_check_element (struct spf_resolved *rec, struct spf_addr *addr, /* Compare the first bytes */ bmask = mask / CHAR_BIT; - if (bmask > addrlen) { + if (mask > addrlen * CHAR_BIT) { msg_info_task ("bad mask length: %d", mask); } else if (memcmp (s, d, bmask) == 0) { - - if (bmask * CHAR_BIT != mask) { + if (bmask * CHAR_BIT < mask) { /* Compare the remaining bits */ s += bmask; d += bmask; mask = (0xff << (CHAR_BIT - (mask - bmask * 8))) & 0xff; + if ((*s & mask) == (*d & mask)) { res = TRUE; } |