diff options
author | Alan Somers <asomers@FreeBSD.org> | 2021-06-11 16:38:07 +0000 |
---|---|---|
committer | Alan Somers <asomers@FreeBSD.org> | 2021-07-04 04:14:06 +0000 |
commit | 5d7ae6fbb117fde20189db763a9561e97c2af35c (patch) | |
tree | 4f2908007abeb979d4becc1b83a8e17613a4f6e4 | |
parent | e63372af710790e6d583a0f1f7d0a3a6e55b5369 (diff) | |
download | src-5d7ae6fbb117fde20189db763a9561e97c2af35c.tar.gz src-5d7ae6fbb117fde20189db763a9561e97c2af35c.zip |
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
Reviewed by: trasz
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D30734
(cherry picked from commit 4a06e9377398b34922f8a67d7cb3ea980b95bde8)
-rw-r--r-- | usr.bin/id/id.c | 2 |
1 files changed, 2 insertions, 0 deletions
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: |