summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2013-12-12 14:43:38 +0000
committermillert <millert@openbsd.org>2013-12-12 14:43:38 +0000
commit3d3334e92488a9e8a5fd12d439740526899383b4 (patch)
tree42538d636ea78d0b0ecaa599a986efb724ea1bb7 /sys
parentDelete spurious blank line. (diff)
downloadwireguard-openbsd-3d3334e92488a9e8a5fd12d439740526899383b4.tar.xz
wireguard-openbsd-3d3334e92488a9e8a5fd12d439740526899383b4.zip
Fix invalid size to memcmp() in rn_lexobetter() introduced when the
hand-rolled loop was converted to memcmp(). From Kieran Devlin. OK markus@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/radix.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/net/radix.c b/sys/net/radix.c
index 0c0f7e09fa2..44b45b9febf 100644
--- a/sys/net/radix.c
+++ b/sys/net/radix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radix.c,v 1.31 2013/10/20 16:17:36 claudio Exp $ */
+/* $OpenBSD: radix.c,v 1.32 2013/12/12 14:43:38 millert Exp $ */
/* $NetBSD: radix.c,v 1.20 2003/08/07 16:32:56 agc Exp $ */
/*
@@ -476,7 +476,7 @@ rn_addmask(void *n_arg, int search, int skip)
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,
@@ -492,8 +492,7 @@ rn_lexobetter(void *m_arg, void *n_arg)
* 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 *