[Bug 854] xtables_ipmask_to_cidr error code leaks into output of iptables --list

bugzilla-daemon at netfilter.org bugzilla-daemon at netfilter.org
Thu Sep 26 17:58:33 CEST 2013


https://bugzilla.netfilter.org/show_bug.cgi?id=854

Phil Oester <netfilter at linuxace.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |netfilter at linuxace.com

--- Comment #1 from Phil Oester <netfilter at linuxace.com> 2013-09-26 17:58:33 CEST ---
Not exactly an error code leak, but a signed/unsigned conversion issue.  Try
below patch (with --ignore-whitespace).

diff --git a/libxtables/xtables.c b/libxtables/xtables.c
index ef5bc07..8437baf 100644
--- a/libxtables/xtables.c
+++ b/libxtables/xtables.c
@@ -1243,7 +1243,7 @@ const char *xtables_ipmask_to_numeric(const struct
in_addr *mask)
        uint32_t cidr;

        cidr = xtables_ipmask_to_cidr(mask);
-       if (cidr < 0) {
+       if (cidr == (unsigned int)-1) {
                /* mask was not a decent combination of 1's and 0's */
                sprintf(buf, "/%s", xtables_ipaddr_to_numeric(mask));
                return buf;

-- 
Configure bugmail: https://bugzilla.netfilter.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the netfilter-buglog mailing list