From owner-svn-src-head@freebsd.org Fri May 25 19:13:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 096D1EF19D0; Fri, 25 May 2018 19:13:13 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 787706FA6A; Fri, 25 May 2018 19:13:12 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-wm0-x22e.google.com with SMTP id q4-v6so14752672wmq.1; Fri, 25 May 2018 12:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc; bh=gbmmhzbhKvr5s1V78RnIZ9+vqJcUVI2MBw/tA3EbnLw=; b=dX3kATkztrHwo8IVh2/dRX9hnN93FDS6MAISaL3MLBRfVFjbS4gbz/hnlrAYpxI7p+ wjItjaidYYlaJ3xJrqqH21lX8j3qWkt+EAwcMPjl9k8Exf5DnUlVQu0km7CNTq6bidRI 2dZ7/LFW5vQREazcZoGct3F+OqBvO5lK4AWAvLDUyG7+OxAIguQ1VfXnlKYo6hEF6ZGC x0EHIGc6y1QN33O2pEBtS/76nA3OxFNZwnt0yxlohBX/a9y6R1xPFdgygGLKEJKIWMZn ddbIyDiywlbWj6vi1c8E02Jlukg2ZZggGEDh0koXDHODk4YXt/VqAMVQETZkc6iCjiBY QdXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=gbmmhzbhKvr5s1V78RnIZ9+vqJcUVI2MBw/tA3EbnLw=; b=t7GUvRZGncndh4vP8S5NyxsZvR130aepW0+NLQJvr5bB4OA/qOEK8XNp96HBVtTpJX yCF/HF3n73vpwoFjfVyPGStffP2mpb+N9jm2zko4CgbYXXWGkT/L3vZlyXEPfSIs905r y3w/kFvgJhbadZu4KsaOdYBpY3QCkt2RMdrNfbblOn+ItDEsWe+UrvckuecJLv9WQo+Y Sn4U8IgvjVXefQ+7z68iIQQ0lL7SavXBctSkF4ac6/A0ujCo/+0ln5LNY9n8OS0FBXe+ CuwF5b/dKI7r6Sb592vEZbRgmUvngyOPi5xs14auMdH9+j6M/tNzQjzcU4U9L8jeHoSG vNAg== X-Gm-Message-State: ALKqPwd/bQbh4IteSW6HDWD6WWHSkbn/msfK1peMsYWU6mya9LceGUcQ RC2hkmVQV56fa/fo+rgErbvktwdRsT7ICnsc5k4= X-Google-Smtp-Source: AB8JxZplxFYPIT68IdTZ4GmkzqA/r1iyQxy9BhLRTx3Mbsz/+f4d45QftYtcyq+HYeMeB/watA0QZPkK3dOE4QVtG5k= X-Received: by 2002:a2e:9cc7:: with SMTP id g7-v6mr2501316ljj.141.1527275591528; Fri, 25 May 2018 12:13:11 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a19:1fc9:0:0:0:0:0 with HTTP; Fri, 25 May 2018 12:13:10 -0700 (PDT) Reply-To: araujo@freebsd.org In-Reply-To: <20180525190846.GL88128@kib.kiev.ua> References: <201805251854.w4PIseSi073002@repo.freebsd.org> <20180525190846.GL88128@kib.kiev.ua> From: Marcelo Araujo Date: Sat, 26 May 2018 03:13:10 +0800 Message-ID: Subject: Re: svn commit: r334216 - head/usr.sbin/bhyve To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 May 2018 19:13:13 -0000 Fixed at r334219. Thanks. 2018-05-26 3:08 GMT+08:00 Konstantin Belousov : > On Fri, May 25, 2018 at 06:54:40PM +0000, Marcelo Araujo wrote: > > Author: araujo > > Date: Fri May 25 18:54:40 2018 > > New Revision: 334216 > > URL: https://svnweb.freebsd.org/changeset/base/334216 > > > > Log: > > After a long discussion about assert(3), we gonna use a HardenedBSD > > approach to chek strdup(3) memory allocation. > > > > Submitted by: Shaw Webb > > Reported by: brooks > > Obtained from: HardenedBSD > > > > Modified: > > head/usr.sbin/bhyve/bhyverun.c > > > > Modified: head/usr.sbin/bhyve/bhyverun.c > > ============================================================ > ================== > > --- head/usr.sbin/bhyve/bhyverun.c Fri May 25 18:11:13 2018 > (r334215) > > +++ head/usr.sbin/bhyve/bhyverun.c Fri May 25 18:54:40 2018 > (r334216) > > @@ -193,7 +193,8 @@ topology_parse(const char *opt) > > c = 1, n = 1, s = 1, t = 1; > > ns = false, scts = false; > > str = strdup(opt); > > - assert(str != NULL); > > + if (str == NULL) > > + goto out; > > > > while ((cp = strsep(&str, ",")) != NULL) { > > if (sscanf(cp, "%i%n", &tmp, &chk) == 1) { > > @@ -225,6 +226,7 @@ topology_parse(const char *opt) > > goto out; > > } > > free(str); > > + str = NULL; > > > > /* > > * Range check 1 <= n <= UINT16_MAX all values > > @@ -253,7 +255,8 @@ topology_parse(const char *opt) > > return(0); > > > > out: > > - free(str); > > + if (str != NULL) > This check is useless. Free(3) is fine handling NULL argument. > > > + free(str); > > return (-1); > > } > > > -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_)