svn commit: r299784 - head/sbin/routed

Pedro F. Giffuni pfg at FreeBSD.org
Sat May 14 23:32:04 UTC 2016


Author: pfg
Date: Sat May 14 23:32:03 2016
New Revision: 299784
URL: https://svnweb.freebsd.org/changeset/base/299784

Log:
  Avoid NULL de-references.
  
  CID:		271079
  Obtained from:	NetBSD
  MFC after:	2 weeks.

Modified:
  head/sbin/routed/output.c

Modified: head/sbin/routed/output.c
==============================================================================
--- head/sbin/routed/output.c	Sat May 14 23:29:41 2016	(r299783)
+++ head/sbin/routed/output.c	Sat May 14 23:32:03 2016	(r299784)
@@ -711,7 +711,7 @@ supply(struct sockaddr_in *dst,
 
 	switch (type) {
 	case OUT_MULTICAST:
-		if (ifp->int_if_flags & IFF_MULTICAST)
+		if (ifp != NULL && ifp->int_if_flags & IFF_MULTICAST)
 			v2buf.type = OUT_MULTICAST;
 		else
 			v2buf.type = NO_OUT_MULTICAST;
@@ -757,7 +757,7 @@ supply(struct sockaddr_in *dst,
 	/*  Fake a default route if asked and if there is not already
 	 * a better, real default route.
 	 */
-	if (supplier && (def_metric = ifp->int_d_metric) != 0) {
+	if (supplier && ifp && (def_metric = ifp->int_d_metric) != 0) {
 		if ((rt = rtget(RIP_DEFAULT, 0)) == NULL 
 		    || rt->rt_metric+ws.metric >= def_metric) {
 			ws.state |= WS_ST_DEFAULT;


More information about the svn-src-all mailing list