[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [PATCH 1/9] setpriv: do not process remaining args
From: Patrick Steinhardt <ps () pks ! im>
Date: 2017-06-29 17:34:28
Message-ID: ab0724cec2b612124c997304d2f93dd879a95a0a.1498757023.git.ps () pks ! im
[Download RAW message or body]
By default, the `getopt32` call will continue parsing the command line
even after hitting a non-option string. But in setpriv, this should be
avoided, as all parameters following the initial non-option argument are
in fact arguments to the binary that is to be executed by setpriv.
Otherwise, calling e.g. `busybox setpriv ls -l` would result in an error
due to the unknown parameter "-l".
Fix the issue by passing "+" as the first character in the options
string. This will cause `getopt32` to stop processing after hitting the
first non-option.
---
util-linux/setpriv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util-linux/setpriv.c b/util-linux/setpriv.c
index 6bd663bf4..686ad45d5 100644
--- a/util-linux/setpriv.c
+++ b/util-linux/setpriv.c
@@ -62,7 +62,8 @@ int setpriv_main(int argc UNUSED_PARAM, char **argv)
opt_complementary = "-1";
applet_long_options = setpriv_longopts;
- opts = getopt32(argv, "");
+ opts = getopt32(argv, "+");
+
if (opts) {
if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0))
bb_simple_perror_msg_and_die("prctl: NO_NEW_PRIVS");
--
2.13.2
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic