Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Dec 2015 05:57:23 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r292585 - head/usr.sbin/uhsoctl
Message-ID:  <201512220557.tBM5vNJF062784@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Tue Dec 22 05:57:23 2015
New Revision: 292585
URL: https://svnweb.freebsd.org/changeset/base/292585

Log:
  Prevent use-after-free with ctx->ns in set_nameservers(..), which could occur
  if the memory wasn't allocated again later on
  
  Reported by: Coverity
  Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
  MFC after: 1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.sbin/uhsoctl/uhsoctl.c

Modified: head/usr.sbin/uhsoctl/uhsoctl.c
==============================================================================
--- head/usr.sbin/uhsoctl/uhsoctl.c	Tue Dec 22 03:07:38 2015	(r292584)
+++ head/usr.sbin/uhsoctl/uhsoctl.c	Tue Dec 22 05:57:23 2015	(r292585)
@@ -452,6 +452,7 @@ set_nameservers(struct ctx *ctx, const c
 			free(ctx->ns[i]);
 		}
 		free(ctx->ns);
+		ctx->ns = NULL;
 	}
 
 	fd = open(respath, O_RDWR | O_CREAT | O_NOFOLLOW, 0666);



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