From e830a247a1c1b3381d0e20868b93e1e047893da0 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Tue, 22 Dec 2015 05:57:23 +0000 Subject: [PATCH] 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 MFC after: 1 week Sponsored by: EMC / Isilon Storage Division --- usr.sbin/uhsoctl/uhsoctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/uhsoctl/uhsoctl.c b/usr.sbin/uhsoctl/uhsoctl.c index 686d45ffd17..9dc13ab3df8 100644 --- a/usr.sbin/uhsoctl/uhsoctl.c +++ b/usr.sbin/uhsoctl/uhsoctl.c @@ -452,6 +452,7 @@ set_nameservers(struct ctx *ctx, const char *respath, int ns, ...) free(ctx->ns[i]); } free(ctx->ns); + ctx->ns = NULL; } fd = open(respath, O_RDWR | O_CREAT | O_NOFOLLOW, 0666);