Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jun 2021 12:52:16 GMT
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4a06e9377398 - main - id: sanitize arguments better
Message-ID:  <202106151252.15FCqG2x098967@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=4a06e9377398b34922f8a67d7cb3ea980b95bde8

commit 4a06e9377398b34922f8a67d7cb3ea980b95bde8
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2021-06-11 16:38:07 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2021-06-15 12:51:16 +0000

    id: sanitize arguments better
    
    The -[AMc] flags ignore the user argument.  Better if id rejects
    invocations that include a user argument along with any of those flags.
    
    PR:             256554
    MFC after:      2 weeks
    Reviewed by:    trasz
    Sponsored by:   Axcient
    Differential Revision: https://reviews.freebsd.org/D30734
---
 usr.bin/id/id.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/usr.bin/id/id.c b/usr.bin/id/id.c
index 5abfb655c948..b8988dedd6f6 100644
--- a/usr.bin/id/id.c
+++ b/usr.bin/id/id.c
@@ -144,6 +144,8 @@ main(int argc, char *argv[])
 
 	if (iswhoami && argc > 0)
 		usage();
+	if ((cflag || Aflag || Mflag) && argc > 0)
+		usage();
 
 	switch(Aflag + Gflag + Mflag + Pflag + gflag + pflag + uflag) {
 	case 1:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106151252.15FCqG2x098967>