From nobody Mon Oct 16 23:32:20 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S8YLF2rjnz4whxp; Mon, 16 Oct 2023 23:32:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S8YLF0ShKz3FXq; Mon, 16 Oct 2023 23:32:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697499141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5XdTETrB/3BNNN4kX8YV3YgzUZEHnHcT7g78JFwiiNI=; b=AYxxZveX8qvfPnck4eQcCF3znqqFcxLp0A/U34ULzkxX7U95qWeoN3bAP50uVPiF7oMrJT XaaEMRrJiLlg7lqjNXM5Tiazub0kF+fhi5GSm5ug8vMpfzO93QqYj926POdBEJMef7PwxF 9AtLEqjZe9YB3IbA9i84nIscJJ8VlqXaVXVnFn/dQCEAFdb9X9z1WTGuCfaDM43ISdvYsI k/WZ0eE0lqrngDdooBiva7Z+I5tzqI3DekQPnso71yjjno0K76e1eOhmA6W78+agA42mk1 CsHzjOwUbnwYmD2+cWZFkODzpG5sckhWF14q2OaU+MF/YwIS1wO3kNLwy0C4tQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697499141; a=rsa-sha256; cv=none; b=d/NzHsrwcREU1JyOi2csecsBjgLBi+l52Whh5stF8aGG4lOEwUwXProQZUTpNhjKSCYL8F OGmDlLRJFAdfTvtnaR7+rIwELccbhY4ZOZpFRhSSPK/Y6wtD+r1DdpXZxxi9PocFDOns9o 3tv3JgRK34wLr3pvG3PfJe2Jc/176nYFqd4SyJq7r8XR7boM9qH5o8Mm5iW+uxc7OfIcyY OKjf4VIxu18p9Yw3vha4QZ9Hl5GBVE45BfgAWH7+kHcJEhVzi3bL3IUVICsNZDVfOhh2rQ Zn7FGZCMVt6GPVWTfRliim2nKYa0tjiPShqzvTneWrTtlxCCopQ+MYgnF2Q3Vw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697499141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5XdTETrB/3BNNN4kX8YV3YgzUZEHnHcT7g78JFwiiNI=; b=IdElSbV21CKacfSDN6FO79F9kMF32gsgKZVQtEbaZ6Qku/sbhWDGiSjBAEKo6A/amfetye eX+0vjX7IAYnBnLqDa659rOpqU4q82kPRdrhXJPbZjakw6PodrpJjJgT/tUmexHaqY9wK+ 0OceajeI3Pr53pqB1eoJD+FXPjvcVvDPQ7MLt0Jxr3QXrFW8jEABzGhZ9XemWD/GzwYwYm cddt75vwSnjTOiZuFFYHGwaONM+TWeoxqBT8C3AIlqJSnGfnTXlAlCnvRh5RDOhsvVip/1 hTwXnZc1IWeYfj5eZdN3jL1A2BXhN7l9m2nLXHkEfGsYl5rkK7nGk5bWk1VkQg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S8YLD68ldz118V; Mon, 16 Oct 2023 23:32:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39GNWKVZ094762; Mon, 16 Oct 2023 23:32:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39GNWKwH094759; Mon, 16 Oct 2023 23:32:20 GMT (envelope-from git) Date: Mon, 16 Oct 2023 23:32:20 GMT Message-Id: <202310162332.39GNWKwH094759@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a8676bf367b0 - main - bsdinstall partedit: Use asprintf to build wrapper command for newfs List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a8676bf367b099dcc97ff61031cbf4ceb5e37899 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a8676bf367b099dcc97ff61031cbf4ceb5e37899 commit a8676bf367b099dcc97ff61031cbf4ceb5e37899 Author: John Baldwin AuthorDate: 2023-10-16 23:25:25 +0000 Commit: John Baldwin CommitDate: 2023-10-16 23:25:25 +0000 bsdinstall partedit: Use asprintf to build wrapper command for newfs Don't abuse the message[] static buffer used elsewhere for error messages to generate the command that actually newfs's each filesystem. Use asprintf to a more aptly-named 'char *command' variable to construct the string instead. This avoids potential bugs from truncation of the command string. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D42239 --- usr.sbin/bsdinstall/partedit/partedit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bsdinstall/partedit/partedit.c b/usr.sbin/bsdinstall/partedit/partedit.c index b6c81ad9fc25..6a216f31161b 100644 --- a/usr.sbin/bsdinstall/partedit/partedit.c +++ b/usr.sbin/bsdinstall/partedit/partedit.c @@ -345,6 +345,7 @@ apply_changes(struct gmesh *mesh) const char **minilabel; const char *fstab_path; FILE *fstab; + char *command; struct bsddialog_conf conf; nitems = 1; /* Partition table changes */ @@ -387,10 +388,11 @@ apply_changes(struct gmesh *mesh) bsddialog_mixedgauge(&conf, "Initializing file systems. Please wait.", 0, 0, i * 100 / nitems, nitems, minilabel, miniperc); - sprintf(message, "(echo %s; %s) >>%s 2>>%s", + asprintf(&command, "(echo %s; %s) >>%s 2>>%s", md->newfs, md->newfs, getenv("BSDINSTALL_LOG"), getenv("BSDINSTALL_LOG")); - error = system(message); + error = system(command); + free(command); miniperc[i] = (error == 0) ? BSDDIALOG_MG_COMPLETED : BSDDIALOG_MG_FAILED; i++;