maybe someone could verify & commit this patch
this bug was introduced in  r1.28 of ‘src/sys/net/radix.c’
i found it while going through source codes

Index: sys/net/radix.c
===================================================================
RCS file: /cvs/src/sys/net/radix.c,v
retrieving revision 1.31
diff -u -p -8 -r1.31 radix.c
--- sys/net/radix.c     20 Oct 2013 16:17:36 -0000      1.31
+++ sys/net/radix.c     10 Dec 2013 09:13:58 -0000
@@ -471,34 +471,33 @@ rn_addmask(void *n_arg, int search, int 
        if (isnormal)
                x->rn_flags |= RNF_NORMAL;
        return (x);
 }
 
 static int     /* XXX: arbitrary ordering for non-contiguous masks */
 rn_lexobetter(void *m_arg, void *n_arg)
 {
-       u_char *mp = m_arg, *np = n_arg, *lim;
+       u_char *mp = m_arg, *np = n_arg;
 
        /*
         * Longer masks might not really be lexicographically better,
         * but longer masks always have precedence since they must be checked
         * first. The netmasks were normalized before calling this function and
         * don't have unneeded trailing zeros.
         */
        if (*mp > *np)
                return 1;
        if (*mp < *np)
                return 0;
        /*
         * Must return the first difference between the masks
         * to ensure deterministic sorting.
         */
-       lim = mp + *mp;
-       return (memcmp(mp, np, *lim) > 0);
+       return (memcmp(mp, np, *mp) > 0);
 }
 
 static struct radix_mask *
 rn_new_radix_mask(struct radix_node *tt, struct radix_mask *next)
 {
        struct radix_mask *m;
 
        MKGet(m);


Reply via email to