Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Add some checks, mostly same as in_arpinput.



details:   https://anonhg.NetBSD.org/src/rev/ffc07b679bcc
branches:  trunk
changeset: 350783:ffc07b679bcc
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jan 21 11:07:46 2017 +0000

description:
Add some checks, mostly same as in_arpinput.

diffstat:

 sys/netinet/if_arp.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r ede4fd07f05c -r ffc07b679bcc sys/netinet/if_arp.c
--- a/sys/netinet/if_arp.c      Sat Jan 21 10:30:15 2017 +0000
+++ b/sys/netinet/if_arp.c      Sat Jan 21 11:07:46 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_arp.c,v 1.238 2017/01/20 19:21:01 maxv Exp $        */
+/*     $NetBSD: if_arp.c,v 1.239 2017/01/21 11:07:46 maxv Exp $        */
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.238 2017/01/20 19:21:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.239 2017/01/21 11:07:46 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1902,6 +1902,10 @@
        tha = ar_tha(ah);
        if (tha == NULL)
                goto out;
+       if (ah->ar_pln != sizeof(struct in_addr))
+               goto out;
+       if (ah->ar_hln != rcvif->if_sadl->sdl_alen)
+               goto out;
        if (memcmp(tha, CLLADDR(rcvif->if_sadl), rcvif->if_sadl->sdl_alen))
                goto out;
        memcpy(&srv_ip, ar_spa(ah), sizeof(srv_ip));



Home | Main Index | Thread Index | Old Index