Module Name:    src
Committed By:   ozaki-r
Date:           Fri Dec  2 00:19:54 UTC 2016

Modified Files:
        src/sys/netinet6: in6_src.c

Log Message:
CID 1396598, CID 1396634: Fix null pointer dereferences


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/netinet6/in6_src.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/in6_src.c
diff -u src/sys/netinet6/in6_src.c:1.74 src/sys/netinet6/in6_src.c:1.75
--- src/sys/netinet6/in6_src.c:1.74	Thu Nov 10 04:13:53 2016
+++ src/sys/netinet6/in6_src.c	Fri Dec  2 00:19:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_src.c,v 1.74 2016/11/10 04:13:53 ozaki-r Exp $	*/
+/*	$NetBSD: in6_src.c,v 1.75 2016/12/02 00:19:54 ozaki-r Exp $	*/
 /*	$KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $	*/
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.74 2016/11/10 04:13:53 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.75 2016/12/02 00:19:54 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -670,9 +670,9 @@ in6_selectroute(struct sockaddr_in6 *dst
 	 *  our own addresses.)
 	 */
 	if (opts && opts->ip6po_pktinfo && opts->ip6po_pktinfo->ipi6_ifindex) {
-		if (!(rt->rt_ifp->if_flags & IFF_LOOPBACK) &&
+		if (rt != NULL && !(rt->rt_ifp->if_flags & IFF_LOOPBACK) &&
 		    rt->rt_ifp->if_index != opts->ip6po_pktinfo->ipi6_ifindex) {
-			if (rt != NULL && count_discard)
+			if (count_discard)
 				in6_ifstat_inc(rt->rt_ifp, ifs6_out_discard);
 			error = EHOSTUNREACH;
 			rt = NULL;

Reply via email to