From nobody Sat Jul 27 11:56:22 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 4WWNPf33kfz5S6dC; Sat, 27 Jul 2024 11:56:22 +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 4WWNPf1zWGz42w0; Sat, 27 Jul 2024 11:56:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722081382; 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=117iTxYWFppByi01/JJRjtKt/Cqa/5mDPbTqAa4LnJc=; b=Cd61dqomj/HSoNdHKdwRTuYaMKe38q6mgtgfXExwyccB8c3i1bxshvXgiCzLJJTl1EfCr2 pd6Ghd1bWP1lje+n48ItlYSUdDXdBFby3rFkT2HIJkclAd/0/oCffXY0jYnFGg/vY8mvBz utpCe7QB7lSJvn0kFqCZgJDmnQCuep82dYcUxrbPfXSjBy3kcK0IUZ8uaEBcDdvDePxTmm xgI9o4SwtaqKQVUJUE1hOK1hYVbQWtgf/ueKgTBdUib3dlyTyiRpart09XHTXZ2ARs171z RHmDMjFrEnphRup9Zg5mXmUbX5EBZpYZm6EpCvMn7lTLK2yI5T+fLc7cWCa6rA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722081382; a=rsa-sha256; cv=none; b=g3Viv/Ub9J2xW7DjJ8P2XWCvys3QhlYQXnuhnlz3oaB3ZSGATG/wrWYgGm4GonyAfmEmUb 7PEzwn3hWJuZzmniOEpjv6nmU8OUepgjFjJ33rhifKzLWrnybIO8Nqcs+S2J5xGwUlfKb4 kqr8Z+Jwz1BUJUbjTRMUbIoOwL6Zcv2WyCRWpWFsnyNNCcfiVWKF8vgIblDCM9gGO8S44B qd4XI6GjFUBasJ58MkiWUDOKobpLM0WwA9uqdkfhAa+fA1lH6x3gbnPS0eSCYRIuStsBFx JM0UFDni3wqIv92awu5zfoo88U3YtmcyorPMHOpv3ns07PJmOQ9rGXxTaMY5AA== 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=1722081382; 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=117iTxYWFppByi01/JJRjtKt/Cqa/5mDPbTqAa4LnJc=; b=gWMIRnW7LuyrWORd5djYNYSbDphJaWX0BD5bF+vXTm0EXcY2IdZDIxHiEsUBW3vebpTZkf OqmK4pxZNggy5iKrfiBhNDDotGoT5Wkyv5VVBHDbDyDLUzWYndsfahNRFN5+mcPSPjmXun rHkTmLrutMTGPKFzYgb68yfM9uH8UapbY8JQvfmFb5VWh8n2aIQyzLe8tFhF/F3PVnll/q jb5rYUo6u0YZrfjbaSE/NBFeH3QGse+dDaCtASvrKLXDiXT6dsc32JX/S3r0wATV7vmBON 8wWrj1pCDbtxa234sqRCaBjqVLdPALjQc+nyNvJqyzWOOKQMNkOAEKI25pF9jw== 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 4WWNPf0lqBz15YP; Sat, 27 Jul 2024 11:56:22 +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 46RBuMDj039804; Sat, 27 Jul 2024 11:56:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46RBuMos039801; Sat, 27 Jul 2024 11:56:22 GMT (envelope-from git) Date: Sat, 27 Jul 2024 11:56:22 GMT Message-Id: <202407271156.46RBuMos039801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 8ca73331ef81 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 8ca73331ef810cd0e0b9e3c37cddc1d89fbe8c6b Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=8ca73331ef810cd0e0b9e3c37cddc1d89fbe8c6b commit 8ca73331ef810cd0e0b9e3c37cddc1d89fbe8c6b Author: Christos Margiolis AuthorDate: 2024-07-27 11:55:09 +0000 Commit: Christos Margiolis CommitDate: 2024-07-27 11:55:09 +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 --- 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);