svn commit: r311994 - head/usr.sbin/route6d
Hiroki Sato
hrs at FreeBSD.org
Thu Jan 12 18:44:59 UTC 2017
Author: hrs
Date: Thu Jan 12 18:44:58 2017
New Revision: 311994
URL: https://svnweb.freebsd.org/changeset/base/311994
Log:
- Fix dereference of NULL pointer which could cause a crash [1]
- Fix memory leak due to lack of freeaddrinfo() [2]
CID: 1018281 [1]
CID: 1225057 [2]
MFC after: 3 days
Modified:
head/usr.sbin/route6d/route6d.c
Modified: head/usr.sbin/route6d/route6d.c
==============================================================================
--- head/usr.sbin/route6d/route6d.c Thu Jan 12 18:05:12 2017 (r311993)
+++ head/usr.sbin/route6d/route6d.c Thu Jan 12 18:44:58 2017 (r311994)
@@ -684,6 +684,7 @@ init(void)
/*NOTREACHED*/
}
#endif
+ freeaddrinfo(res);
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_INET6;
@@ -699,6 +700,7 @@ init(void)
/*NOTREACHED*/
}
memcpy(&ripsin, res->ai_addr, res->ai_addrlen);
+ freeaddrinfo(res);
#ifdef HAVE_POLL_H
set[0].fd = ripsock;
@@ -788,10 +790,17 @@ ripflush(struct ifc *ifcp, struct sockad
error = sendpacket(sin6, RIPSIZE(nrt));
if (error == EAFNOSUPPORT) {
/* Protocol not supported */
- tracet(1, "Could not send info to %s (%s): "
- "set IFF_UP to 0\n",
- ifcp->ifc_name, inet6_n2p(&ifcp->ifc_ripsin.sin6_addr));
- ifcp->ifc_flags &= ~IFF_UP; /* As if down for AF_INET6 */
+ if (ifcp != NULL) {
+ tracet(1, "Could not send info to %s (%s): "
+ "set IFF_UP to 0\n",
+ ifcp->ifc_name,
+ inet6_n2p(&ifcp->ifc_ripsin.sin6_addr));
+ /* As if down for AF_INET6 */
+ ifcp->ifc_flags &= ~IFF_UP;
+ } else {
+ tracet(1, "Could not send info to %s\n",
+ inet6_n2p(&sin6->sin6_addr));
+ }
}
}
More information about the svn-src-all
mailing list