From nobody Mon Dec 16 14:46:01 2024 X-Original-To: dev-commits-src-main@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 4YBjRs3k0Tz5hWLw; Mon, 16 Dec 2024 14:46:01 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YBjRs2bWGz4drb; Mon, 16 Dec 2024 14:46:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734360361; 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=rM7cHnRNlSKUSuPnyow7zBl03HQbFxDKkeOOhOAI1uo=; b=mWfeuVQOsu89HUBGiQpt8OlCIeg/1qhdRit/OaAe9vQMNLWt/Gh0ZTKTX5Sk5hbEvrkHyf D9UJ72ztoFzQB9mdeFkul7QLLtophaa5muZazkaiXw3cSoObHLoeknTAztejRayDOo1Sb2 Jzq2/23bYTC+l9XLlcmV7f+rijhsisjvUYnU1YwxEbgJwZyu9vJIOAvTK5RRK/5K6H0JK1 PgK7Se6t2sTIFN7BeamPAx/qqwgs8e/YW0Ubb2TbuZnipjaQ4O2w+KRr+jrI/8XnOiQMjm IYiOdmEkBVarUI3tKF3V1co8y4rynIkycUrN2PbL4qWNTViRGZ6jiv3WA6ZytQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734360361; 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=rM7cHnRNlSKUSuPnyow7zBl03HQbFxDKkeOOhOAI1uo=; b=ScqkkRerqRBVI5uYsnRhKurWkJVe8pU9634eJy99ElACZ4k4olodltZnCpeUxHt/lxwRxD +5zPGD/nOIHbZb4VqmUV2/t4ITJxSczYwzOGwt+n1ct6TBsVwiJp5LDeiK2+kN0XKmXjmZ 1iSaqCESxOK/IAFy1Ez1uoXqzCIGVdGFRz4gXKSrLrQ//rQzkyDWcAqlZyVSTQJJJLA5h6 9A8+nY01izcXposy4bj9PhxwGWTutw+teX7jyG/o8FFedxNO2X+SmKpYaG7ZCM8Lc1wlhD GSMV+gf8GNcajSuVH48Kjmw4aDyQSNifW5aYhFFmcFRL2AM6+kykZK9fEYtMHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734360361; a=rsa-sha256; cv=none; b=GcI44o17JcBGEmonLAGscO6lwLv/poJiyr+goaJDy5s8Ef6E0BkInlrjIdMBRh09/yNHKx HdXri503r8c3OWq/HKAl0sSr70YA5G+nBHgLnzims4d3wyGjqICQ5inZaeItBx8Ws8Gnx4 9NS13G4JXGLzG7qIq/0n1uGu1VtR24rijazeuSCAAVPSzoajqzw5EAio+Nk4F77FLQ9drS 6PP2AJsL1Gn57kAkU8M6nAB+6i/VusjpjoDkTi2o9jYZoXHUmebyasPcHBWp4dawhPbFju x7/TOwwbik2hiFeZjS/hKnbx7tSO59C0UA/iqVz7MQQ3KVzAPLghNmQZero47A== 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 4YBjRs26m2zxWx; Mon, 16 Dec 2024 14:46:01 +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 4BGEk1rA053561; Mon, 16 Dec 2024 14:46:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BGEk1EW053558; Mon, 16 Dec 2024 14:46:01 GMT (envelope-from git) Date: Mon, 16 Dec 2024 14:46:01 GMT Message-Id: <202412161446.4BGEk1EW053558@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: fa4352b74580 - main - MAC/do: parse_rule_element(): Bug in parsing the origin ID List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa4352b74580832d7b501d34d09a564438a82c3d Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=fa4352b74580832d7b501d34d09a564438a82c3d commit fa4352b74580832d7b501d34d09a564438a82c3d Author: Olivier Certner AuthorDate: 2024-07-05 11:49:27 +0000 Commit: Olivier Certner CommitDate: 2024-12-16 14:42:37 +0000 MAC/do: parse_rule_element(): Bug in parsing the origin ID The ID field was allowed to be empty, which would be then parsed as 0 by strtol(). There remains bugs in this function, where parsing for from- or to- IDs accepts spaces and produces 0, but this will conveniently be fixed in a later commit introducing strtoui_strict(). Reviewed by: bapt Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47612 --- sys/security/mac_do/mac_do.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c index 4ef9b68bf513..edd728ea070a 100644 --- a/sys/security/mac_do/mac_do.c +++ b/sys/security/mac_do/mac_do.c @@ -105,7 +105,7 @@ parse_rule_element(char *element, struct rule **rule) } id = strsep(&element, ":"); - if (id == NULL) { + if (id == NULL || *id == '\0') { error = EINVAL; goto error; }