From nobody Mon Jul 29 15:35:19 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 4WXj9N2Xf0z5RSgj; Mon, 29 Jul 2024 15:35:20 +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 4WXj9M6lYyz42Nk; Mon, 29 Jul 2024 15:35:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722267320; 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=nimJA6y82932+3GupznmYEOEpb5cVGWCxvMV0s0wkyc=; b=TTRURGTdSAkOo+trJuImaaPN58IJF9n9FDUvJp4hNW/1/d09aaA8uIWI0Nz+AGji+U/HhQ SYWlQJtOEHb2c8W2Oooe9pUbNYu3bz5VIlQyokykkpc9sUIA8LoyLiPntx/ZEeszaNPIID +2vfl9/iRwZD653GhTx0fzZelBhHYs/izzUVRFJvjKgpgznnoT77aKnavH6pNs6slwCSag MF6ySMfuafq1egixHbHoN4gEp5OG3DLiLuDCwG2hMGEd8Ut7VVe2YiDqULBiTpK8hgCWAM f6bIFYg4ATV59zbJOgnqjOFTxmTu2JkEnbLWP30Ci+swhJRanFkbz5k516feUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722267320; a=rsa-sha256; cv=none; b=c3nNfRPzGsumDAhEBLruaAoA6vLIwbzSGgI8hW745WM+rw3QND7JF9c/zYT+3zyOSksLs9 TpSVJeAMIGbByeROhzv3ZxM4yQGUbsmw5ByjcPh/Rhxd1NKeO7sFBCwJ7BbaKhPWDZuve+ UpL8zwPcyJYJ/4FsQnA62xVHW/+IfA/vLqVj0smSwpcOV+YxsE8laokbEpTKM+Thp3m4II yNIVXvoyUEnlYuGn+4hKpghhXVFXGy7gDZxoeFwvPG1J3dU5kP5nqyjlZ9Lv23KbfT/maM toTOtPBAvksmNoKJTD3YjUiwwWDQ79cRLJlTzxw+AgcBzepFFLib0JS13v6jUw== 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=1722267320; 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=nimJA6y82932+3GupznmYEOEpb5cVGWCxvMV0s0wkyc=; b=ro1favtHmc66ElcwdddHLZI5lj3rzrgBEmbrBOJjy0P0hq2gyBCnEpLIjhCV4dfwXOrup+ vcNUugwzlUmFFepQ81E7vNG8G0Y7M6bQz27pF1vRTLNOLDbI/ooIdG9EAjRBazPq4hE6qb a4XhqcVHjyoY5G3zaSoE+BJtWnUs3Ze4M9CFm8xDCIB3imsWsxm1eKtG/rsNj/MSF0DkQ2 2vrJOVSIPjc2S+iBGT2FsmICc3E+6MCl3U8TvZrm/RQePvh7qJzak7bc1crnpZ9GwgZPfh mhspuDMvbRveG9+bXGOqgqTexY3/k8vMgQb5zn4PLhpmQZSgXy2QgStT9k1KXA== 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 4WXj9M624JzgDG; Mon, 29 Jul 2024 15:35:19 +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 46TFZJ6x002406; Mon, 29 Jul 2024 15:35:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46TFZJUY002402; Mon, 29 Jul 2024 15:35:19 GMT (envelope-from git) Date: Mon, 29 Jul 2024 15:35:19 GMT Message-Id: <202407291535.46TFZJUY002402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: bf3d523408d4 - stable/14 - mixer(8): Make mute and recsrc argument parsing more robust 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: christos X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: bf3d523408d48126e83a097978e2db469954d238 Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=bf3d523408d48126e83a097978e2db469954d238 commit bf3d523408d48126e83a097978e2db469954d238 Author: Christos Margiolis AuthorDate: 2024-07-27 11:55:09 +0000 Commit: Christos Margiolis CommitDate: 2024-07-29 15:34:54 +0000 mixer(8): Make mute and recsrc argument parsing more robust For the deprecated argument interfaces of the mute (1, 0, ^) and recsrc (+, -, =, ^) controls, we only check the first character of the argument, which means that an argument such as "vol.mute=10" would be valid. Fix this by checking the whole argument string. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D45973 (cherry picked from commit 8ca73331ef810cd0e0b9e3c37cddc1d89fbe8c6b) --- usr.sbin/mixer/mixer.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c index 07dd16536495..109d3ad09bc5 100644 --- a/usr.sbin/mixer/mixer.c +++ b/usr.sbin/mixer/mixer.c @@ -426,11 +426,14 @@ mod_mute(struct mix_dev *d, void *p) m = d->parent_mixer; cp = mixer_get_ctl(m->dev, C_MUT); val = p; - if (strncmp(val, "off", strlen(val)) == 0 || *val == '0') + if (strncmp(val, "off", strlen(val)) == 0 || + strncmp(val, "0", strlen(val)) == 0) opt = MIX_UNMUTE; - else if (strncmp(val, "on", strlen(val)) == 0 || *val == '1') + else if (strncmp(val, "on", strlen(val)) == 0 || + strncmp(val, "1", strlen(val)) == 0) opt = MIX_MUTE; - else if (strncmp(val, "toggle", strlen(val)) == 0 || *val == '^') + else if (strncmp(val, "toggle", strlen(val)) == 0 || + strncmp(val, "^", strlen(val)) == 0) opt = MIX_TOGGLEMUTE; else { warnx("%s: no such modifier", val); @@ -459,13 +462,17 @@ mod_recsrc(struct mix_dev *d, void *p) m = d->parent_mixer; cp = mixer_get_ctl(m->dev, C_SRC); val = p; - if (strncmp(val, "add", strlen(val)) == 0 || *val == '+') + if (strncmp(val, "add", strlen(val)) == 0 || + strncmp(val, "+", strlen(val)) == 0) opt = MIX_ADDRECSRC; - else if (strncmp(val, "remove", strlen(val)) == 0 || *val == '-') + else if (strncmp(val, "remove", strlen(val)) == 0 || + strncmp(val, "-", strlen(val)) == 0) opt = MIX_REMOVERECSRC; - else if (strncmp(val, "set", strlen(val)) == 0 || *val == '=') + else if (strncmp(val, "set", strlen(val)) == 0 || + strncmp(val, "=", strlen(val)) == 0) opt = MIX_SETRECSRC; - else if (strncmp(val, "toggle", strlen(val)) == 0 || *val == '^') + else if (strncmp(val, "toggle", strlen(val)) == 0 || + strncmp(val, "^", strlen(val)) == 0) opt = MIX_TOGGLERECSRC; else { warnx("%s: no such modifier", val);