validate sa_len on equal() macro. without the change we may touch the content
of a2 beyond a2->sa_len mistakelnly. sync with kame
This commit is contained in:
parent
febe7ce944
commit
866fc79bb9
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: route.c,v 1.44 2001/07/18 16:43:10 thorpej Exp $ */
|
||||
/* $NetBSD: route.c,v 1.45 2001/07/20 18:52:18 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -301,7 +301,9 @@ rtredirect(dst, gateway, netmask, flags, src, rtp)
|
|||
* we have a routing loop, perhaps as a result of an interface
|
||||
* going down recently.
|
||||
*/
|
||||
#define equal(a1, a2) (bcmp((caddr_t)(a1), (caddr_t)(a2), (a1)->sa_len) == 0)
|
||||
#define equal(a1, a2) \
|
||||
((a1)->sa_len == (a2)->sa_len && \
|
||||
bcmp((caddr_t)(a1), (caddr_t)(a2), (a1)->sa_len) == 0)
|
||||
if (!(flags & RTF_DONE) && rt &&
|
||||
(!equal(src, rt->rt_gateway) || rt->rt_ifa != ifa))
|
||||
error = EINVAL;
|
||||
|
|
Loading…
Reference in New Issue