Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jun 2016 14:40:41 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r301789 - stable/10/usr.sbin/route6d
Message-ID:  <201606101440.u5AEefB0042805@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Fri Jun 10 14:40:41 2016
New Revision: 301789
URL: https://svnweb.freebsd.org/changeset/base/301789

Log:
  MFC r299491:
  r299491 (by cem):
  
  route6d(8): Fix potential double-free
  
  In the case that the subsequent sysctl(3) call failed, 'buf' could be free(3)ed
  repeatedly.  It isn't clear to me that that case is possible, but be clear and
  do the right thing in case it is.
  
  CID:		272537

Modified:
  stable/10/usr.sbin/route6d/route6d.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/route6d/route6d.c
==============================================================================
--- stable/10/usr.sbin/route6d/route6d.c	Fri Jun 10 14:33:21 2016	(r301788)
+++ stable/10/usr.sbin/route6d/route6d.c	Fri Jun 10 14:40:41 2016	(r301789)
@@ -2602,8 +2602,10 @@ krtread(int again)
 			sleep(1);
 		retry++;
 		errmsg = NULL;
-		if (buf)
+		if (buf) {
 			free(buf);
+			buf = NULL;
+		}
 		if (sysctl(mib, 6, NULL, &msize, NULL, 0) < 0) {
 			errmsg = "sysctl estimate";
 			continue;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606101440.u5AEefB0042805>