From nobody Tue Jan 02 20:52:40 2024 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 4T4Q611Bg6z56JFn; Tue, 2 Jan 2024 20:52:41 +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 4T4Q610cGqz4Xy8; Tue, 2 Jan 2024 20:52:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704228761; 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=KM71AnCqSaDoENBl7UjVlKhYL4YS3f+zqXqszVFp8MM=; b=P9hGrdsmhQVf+3E2AyKAGv/ertKwO69RuRhscavMoMUldTeg2lwuFHypqgcMA3IpQjhxyY nb2Pw0ra9vFVfcsOreadrYSOtjUX9gSNRb4xnmoWX4XWD2Q92DnMOPh52Af0DLWU384oNR BapLXRL5Mfd8qfzEanF+75Zt+dA/N/fqsYecQs5JF54qpcswYH+o/6591N+GqIeXEp8sw0 /3CS9eUG/0Cx5+zEKhiB5RmLKq70Pn06t+zrjMPcspUsj9MU9Kp8uf+KCdohhO/boAZjT2 o1mV1vIL6fs3PvsZ+1ljGNVhjqOwm24vk+Spg3wK8hkxmlrYzjjuByO0XMe0Cg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704228761; a=rsa-sha256; cv=none; b=UcxcltmO/nZZ4SZvUD50dtQp927wZOSI/oAncQFQSrY0Sh9sISDmTh7YH19GsyiNNxBOQc mDJPnGmVzEmNrqqK7QstZurQsga1A8UdJp8hkW9QYUJplAyK30XrJQICelgFqKHWMKThqZ wr+A3fkPz5lvsyXgR9tvUXMwbWgMegMiwwsGJAd6pyk5OF9sEVUnWrHr+LQnVr4FjMd0Yo fs8ez+c1rtut9sEG0vmc0UX6zPhcoYI7JRCIpMCJUGI0DvvzSPorv3aw6GSvvEHp+6qNvM /DbMmaZTyDBquHz3L8b74a+dBo1rUNLAuvIFY/vwwOlzPHZ/SF5FLo/lK+xDXw== 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=1704228761; 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=KM71AnCqSaDoENBl7UjVlKhYL4YS3f+zqXqszVFp8MM=; b=aR+nAW/pi5V6NCQK3YewmMarp0H7naJ9PLvTez6KLrblbmwa9OngZEsW9rJHhtNu+xncpn zIjOQiycp3x5g48zdbk5vV+aWnenLJXMnaF3rHfH5NXpGpKNxiAh8xG37U4zimjJqO+YSk U7kvAn6iub5GbVfQFa1Q0oI7M9SGPFxsZMwKXjkiHuL3dB2XCPIGCETkV8g7S9qSLXq61l 9F7sogpyWyTu+rPBTpliidsz56NvwGv8XGKCEyuxL8/k0PvakZb3XzwQDSmH6OA+I8Nk9U H+0ezp2WiOfFGb+eopUid2YI1SS4QbidDRTDzsKpaL8mt+dOpe6ksqOyw+codg== 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 4T4Q606p55z1FmX; Tue, 2 Jan 2024 20:52:40 +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 402Kqeew037096; Tue, 2 Jan 2024 20:52:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 402KqeEL037093; Tue, 2 Jan 2024 20:52:40 GMT (envelope-from git) Date: Tue, 2 Jan 2024 20:52:40 GMT Message-Id: <202401022052.402KqeEL037093@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 10415f634193 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 10415f6341936216197c9bb127e2b579a2189a33 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=10415f6341936216197c9bb127e2b579a2189a33 commit 10415f6341936216197c9bb127e2b579a2189a33 Author: John Baldwin AuthorDate: 2023-10-16 23:25:25 +0000 Commit: John Baldwin CommitDate: 2024-01-02 19:20:37 +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 (cherry picked from commit a8676bf367b099dcc97ff61031cbf4ceb5e37899) --- 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 3067efc0ae9b..9e25a2b31d1f 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++;