From: Michael Tremer Date: Sun, 7 Feb 2021 16:46:55 +0000 (+0000) Subject: misc-progs: Call unpriv_system commands in a shell X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=23f280b5e6d12bfde411a227656985b021de5883;p=people%2Fms%2Fipfire-2.x.git misc-progs: Call unpriv_system commands in a shell Reported-by: Arne Fitzenreiter Signed-off-by: Michael Tremer --- diff --git a/src/misc-progs/setuid.c b/src/misc-progs/setuid.c index efd181ad8c..8044742f2d 100644 --- a/src/misc-progs/setuid.c +++ b/src/misc-progs/setuid.c @@ -144,7 +144,14 @@ int safe_system(char* command) { /* Much like safe_system but lets you specify a non-root uid and gid to run * the command as */ int unpriv_system(char* command, uid_t uid, gid_t gid) { - return system_core(command, NULL, uid, gid, "unpriv_system"); + char* argv[4] = { + "/bin/sh", + "-c", + command, + NULL, + }; + + return system_core(argv[0], argv, uid, gid, "unpriv_system"); } /* General routine to initialise a setuid root program, and put the