From nobody Thu Dec 12 08:27:05 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 4Y85DV0xmtz5hBV6; Thu, 12 Dec 2024 08:27:06 +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 4Y85DV00Wzz3xZL; Thu, 12 Dec 2024 08:27:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733992026; 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=TI9A/GKANyQLh6sbKSAelgVkmIJLKt1JCq8sFAN2CAI=; b=IWRvWhX6Jp3c/h9OMTKnrgqR3uEbrYEApgBt8oaXr3oYubKhS8DAyjWkQA4fWIU3ElWUX/ UTz0ByC9zimKWd7TR4qBU4SsbSdy3rpA423xoMvNCUGZm/EZWFA0xrKglKYMvyC2RUA7X3 sbqlBLSh7Up2Z+3oIC+OH8EGflCPel+8h+LE4qaoD1FJdhl1BlgsBHANf6PePQCv8oPbz2 KY+IBDbC/ouAJhHvEdv2X2wP7JhGM7hk1XbWf8BciiV+Wu2RFVPp58j1NiA1SVb+nsNZtZ cv/VOX3xB9/7qmQi790aQZCHCpt/JrzD/G5PZJ6HU+u6S97smKYCD9kqCoovgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733992026; 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=TI9A/GKANyQLh6sbKSAelgVkmIJLKt1JCq8sFAN2CAI=; b=RqaKpJmNhLIlGgCHHK0nGSGTW6wCPnLJiaf66pXbQaI1oMkEdYBMnQgqgWET7rB1+/dDZj TWQSxR3NfzjWXF9IlAs5zfVBuFQFZM3aXZTmzseeLXss/KXqmwyNp0V+sdla69XyWqH4Cg eL3zilz4IwMZdFj1l0ejzWRcm1snM6dPCmbPnL9Atktd9FqBAutLTIiXh4oddfi7p2rMIt LghFf1FXNNrygx4QTEMfEsCEGDyDiCuS9hKEYAERLAx3nnu3IKikwVWLgRWhMdxEf9gPV8 j9ulHkcj/kOkxHVtqfoKjbdGPte0uyf75iiZPF06F6zvMKoljcB0rMYJrGRHEA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733992026; a=rsa-sha256; cv=none; b=fZKjFY9rMK26C3c3HGjXoYvVGTmgLyJ6CsyUkBCThJVReeULbzHl6NkmRY72jQlW3Ux6h6 2Zt3PZb111ui3mbItaQKiCRJl+viyqehGCLqirKhOltdz8Ru9jwEp7Btuwm7A/8moQnss2 xUet/usHuSTkd9QIlskFSL8FgI7MxJ89/bVB7icR5JBHyNw4xt1C+SUbszebPXcAuvmVqg iolZhib3OShLNGfBpULmUxSM4UnQgsM5dA4j1jAUdwVI0vtzaLfPXtwlifYhFr5XFjorCP 4NnKdSOIrCtmVzl0gthc5OAgGRtCEyQoHm+1w2iF67be02fyrXkC3JGvFDAqpg== 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 4Y85DT6b3DzlWK; Thu, 12 Dec 2024 08:27:05 +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 4BC8R5I5091465; Thu, 12 Dec 2024 08:27:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BC8R51Y091462; Thu, 12 Dec 2024 08:27:05 GMT (envelope-from git) Date: Thu, 12 Dec 2024 08:27:05 GMT Message-Id: <202412120827.4BC8R51Y091462@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: dfd52321b7be - main - nl(1): Capsicumise the utility 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: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dfd52321b7beba716fa2bdd4f54e57e9ac806e96 Auto-Submitted: auto-generated The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=dfd52321b7beba716fa2bdd4f54e57e9ac806e96 commit dfd52321b7beba716fa2bdd4f54e57e9ac806e96 Author: Faraz Vahedi AuthorDate: 2024-10-13 20:03:25 +0000 Commit: Mariusz Zaborski CommitDate: 2024-12-12 08:24:31 +0000 nl(1): Capsicumise the utility Signed-off-by: Faraz Vahedi Reviewed by: markj, oshogbo MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1465 --- usr.bin/nl/nl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/usr.bin/nl/nl.c b/usr.bin/nl/nl.c index a6a14239f582..573e03e4ad0d 100644 --- a/usr.bin/nl/nl.c +++ b/usr.bin/nl/nl.c @@ -42,6 +42,8 @@ #include #include +#include + typedef enum { number_all, /* number all lines */ number_nonempty, /* number non-empty lines */ @@ -244,6 +246,11 @@ main(int argc, char *argv[]) /* NOTREACHED */ } + /* Limit standard descriptors and enter capability mode */ + caph_cache_catpages(); + if (caph_limit_stdio() < 0 || caph_enter() < 0) + err(EXIT_FAILURE, "capsicum"); + /* Generate the delimiter sequence */ memcpy(delim, delim1, delim1len); memcpy(delim + delim1len, delim2, delim2len);