git: c195ae95912a - stable/14 - bintrans: disable argument permutation for qp and base64

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Sat, 26 Apr 2025 03:21:17 UTC
The branch stable/14 has been updated by kevans:

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

commit c195ae95912ac873c62ba6325a82fc39b6aecc7a
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2025-04-20 18:08:09 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2025-04-26 03:19:48 +0000

    bintrans: disable argument permutation for qp and base64
    
    Err on the side of caution and revert to the BSD-style getopt(3)
    behavior for argument processing, as it's harder to go back and it's
    not clear that this was strictly intentional.
    
    This is the difference between allowing `base64 /COPYRIGHT -w 80` and
    forcing `base64 -w 80 /COPYRIGHT`.
    
    Reviewed by:    emaste, pstef
    
    (cherry picked from commit d8fd551438706b3766da23e72ef077945ba43cd3)
---
 usr.bin/bintrans/bintrans.c | 2 +-
 usr.bin/bintrans/qp.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.bin/bintrans/bintrans.c b/usr.bin/bintrans/bintrans.c
index c4b443a9009b..e5e9ac17d524 100644
--- a/usr.bin/bintrans/bintrans.c
+++ b/usr.bin/bintrans/bintrans.c
@@ -139,7 +139,7 @@ base64_encode_or_decode(int argc, char *argv[])
 		{NULL,		no_argument,		NULL, 0}
 	};
 
-	while ((ch = getopt_long(argc, argv, "diw:", opts, NULL)) != -1)
+	while ((ch = getopt_long(argc, argv, "+diw:", opts, NULL)) != -1)
 		switch (ch) {
 		case 'd':
 			decode = true;
diff --git a/usr.bin/bintrans/qp.c b/usr.bin/bintrans/qp.c
index 862db437f4e0..a989b17e7162 100644
--- a/usr.bin/bintrans/qp.c
+++ b/usr.bin/bintrans/qp.c
@@ -181,7 +181,7 @@ main_quotedprintable(int argc, char *argv[])
 		{NULL,		no_argument,		NULL, 0}
 	};
 
-	while ((ch = getopt_long(argc, argv, "do:ru", opts, NULL)) != -1) {
+	while ((ch = getopt_long(argc, argv, "+do:ru", opts, NULL)) != -1) {
 		switch(ch) {
 		case 'o':
 			fpo = fopen(optarg, "w");