From nobody Wed Oct 23 22:13:23 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 4XYjwz5HCBz5ZkVX; Wed, 23 Oct 2024 22:13:23 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XYjwz2krWz4cq4; Wed, 23 Oct 2024 22:13:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729721603; 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=ORppuBflCJ82eEQcZ6t+vbGWVF+t86S85c+zm3zex80=; b=Pfc6VxnfMIyl8nH+qRZ8UC1i9UzIDnupoeWoZSAFu8YAL46I14Vx0c2hjJbIIGgmUPRcFi KntQNcLSMpDDWshMLyy/739rIxbxJz4/kXifz4pAObF42C6yI9hxmketfCfXjQhr2isO5J dv/zK056aqIw0quQCzqZDpaoQoPPVsjcAkt5c+aTX+X1NpAUYjBmfGlvz6XjD6c4rR7gZh tZPMjNT15Mpiunx79VYGqDmu6CxUP/tUh8EoV3WbhutiHRM6vFVSUTcKQgkWSPY8BVZohc PCzA0c0PpPyrrVdk1Y0EsCIhx5ypMl96983s58qk6Usw0XDDbPTTmXwUWhn7dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729721603; 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=ORppuBflCJ82eEQcZ6t+vbGWVF+t86S85c+zm3zex80=; b=ux4nSMbdgunCytJFEzEMtCKeu9eomh6Ln/mihdOxGjM5z77PyMFqyV7R5ceGLQt9hkxOBE MTKNVp7FmFIZy72MhXPo8vvWsYSn1uhm4GsBbIfthz7hCqQImQ3Ex/q0CWy71mImi42oqr I/2F+MoPAYOaHpbFoVCjhqWXIVjVTQj/FjBXI96DMiZCWl9YZIYR+CvGNeCvE1B0nilvFZ E13PUSMclZfWk5DOcAwGkLQibsXEq1Jz6H1hI8x3KWS3sShC+86PPl3WkJfLW0TBwXYIF3 +aESouUcdoDKIHc+VT1mIvqhjJUjFPCoFsBnmFI030hv1jjOaPp1bSijv+zQTQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729721603; a=rsa-sha256; cv=none; b=qjIzyvvcvvOAFPuJ6K2cNI3LCizjn4Dn8tv7c7X+QlEhaxqlqb426XScKO0xKYQgCKhBq3 vCjNxqYbcAMquCdBL+6SCJzcadY1g8gw7bodP46AOKv4pOjIX5xEDWpchJZkMu9HMojOQk cPLdOn+lEfdzx0CX2fUvFST5iyKfj5vKTilWxoS/0N+JLN+eaFzETrrYNBbKqi/3cVPwGi dVFxb1VHJXIlTR97nKzFDaharK9NwTDn9QOjfhLDThMiOB1k0A2lbn+Rcoo+vq+WqQnkm4 lXoP7xsrEMlY/lfh2nIYMmTY1m9n2NtAcAeot6xJwydSVyuCxzcWDHt0iArHCQ== 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 4XYjwz2KKlzGcq; Wed, 23 Oct 2024 22:13:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49NMDNb0085690; Wed, 23 Oct 2024 22:13:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49NMDNbb085687; Wed, 23 Oct 2024 22:13:23 GMT (envelope-from git) Date: Wed, 23 Oct 2024 22:13:23 GMT Message-Id: <202410232213.49NMDNbb085687@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c22be0b181e9 - main - mixer: Fix a bogus free() call in the main loop 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c22be0b181e954a4cc00ed4f5c7df974f3061c3c Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c22be0b181e954a4cc00ed4f5c7df974f3061c3c commit c22be0b181e954a4cc00ed4f5c7df974f3061c3c Author: Mark Johnston AuthorDate: 2024-10-23 16:55:39 +0000 Commit: Mark Johnston CommitDate: 2024-10-23 22:12:45 +0000 mixer: Fix a bogus free() call in the main loop After a strsep() call, p might not point at the original allocation anymore. Reported by: CHERI Reviewed by: christos MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47266 --- usr.sbin/mixer/mixer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c index 468130ddaa88..70a35f71b25f 100644 --- a/usr.sbin/mixer/mixer.c +++ b/usr.sbin/mixer/mixer.c @@ -147,7 +147,9 @@ main(int argc, char *argv[]) parse: while (argc > 0) { - if ((p = strdup(*argv)) == NULL) + char *orig; + + if ((orig = p = strdup(*argv)) == NULL) err(1, "strdup(%s)", *argv); /* Check if we're using the shorthand syntax for volume setting. */ @@ -200,7 +202,7 @@ parse: /* Input: `dev.control=val`. */ cp->mod(cp->parent_dev, valstr); next: - free(p); + free(orig); argc--; argv++; }