]> source.dussan.org Git - rspamd.git/commitdiff
Parse masks with a single number correctly.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 24 Sep 2013 11:19:52 +0000 (12:19 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 24 Sep 2013 11:19:52 +0000 (12:19 +0100)
src/spf.c

index 18fdeb412bdc2040638e95e68f1a06dc35ada22e..456d5395205d50312afbcdecf9f9bc6f7ea36141 100644 (file)
--- a/src/spf.c
+++ b/src/spf.c
@@ -314,7 +314,7 @@ parse_spf_ipmask (const gchar *begin, struct spf_addr *addr)
        if (state == 2) {
                /* Also parse mask */
                if (!addr->data.normal.ipv6) {
-                       addr->data.normal.mask = (mask_buf[0] - '0') * 10 + mask_buf[1] - '0';
+                       addr->data.normal.mask = strtoul (mask_buf, NULL, 10);
                        if (addr->data.normal.mask > 32) {
                                msg_info ("bad ipmask value: '%s'", begin);
                                return FALSE;