From owner-svn-src-all@freebsd.org Thu Jan 12 18:44:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2A84CAB7BF; Thu, 12 Jan 2017 18:44:59 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A240714C5; Thu, 12 Jan 2017 18:44:59 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0CIiwRZ006943; Thu, 12 Jan 2017 18:44:58 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0CIiw5v006942; Thu, 12 Jan 2017 18:44:58 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201701121844.v0CIiw5v006942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Thu, 12 Jan 2017 18:44:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311994 - head/usr.sbin/route6d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2017 18:44:59 -0000 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)); + } } }