From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter =?utf-8?q?M=C3=BCller?= To: development@lists.ipfire.org Subject: Re: [PATCH] misc-progs: Add path to executable to argv Date: Fri, 17 Jun 2022 08:52:01 +0000 Message-ID: In-Reply-To: <20220615095320.1972533-1-michael.tremer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4083160071522644035==" List-Id: --===============4083160071522644035== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Acked-by: Peter M=C3=BCller > Otherwise, the first argument would always be swollowed :( >=20 > Signed-off-by: Michael Tremer > --- > src/misc-progs/setuid.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) >=20 > diff --git a/src/misc-progs/setuid.c b/src/misc-progs/setuid.c > index 831fb1f90..17b0e7066 100644 > --- a/src/misc-progs/setuid.c > +++ b/src/misc-progs/setuid.c > @@ -61,10 +61,8 @@ static int system_core(char* command, char** args, uid_t= uid, gid_t gid, char *e > if(!command) > return 1; > =20 > -#if 0 > // Add command as first element to argv > argv[argc++] =3D command; > -#endif > =20 > // Add all other arguments > if (args) { > @@ -138,7 +136,7 @@ int safe_system(char* command) { > NULL, > }; > =20 > - return system_core(argv[0], argv, 0, 0, "safe_system"); > + return system_core(argv[0], argv + 1, 0, 0, "safe_system"); > } > =20 > /* Much like safe_system but lets you specify a non-root uid and gid to r= un > @@ -151,7 +149,7 @@ int unpriv_system(char* command, uid_t uid, gid_t gid) { > NULL, > }; > =20 > - return system_core(argv[0], argv, uid, gid, "unpriv_system"); > + return system_core(argv[0], argv + 1, uid, gid, "unpriv_system"); > } > =20 > /* General routine to initialise a setuid root program, and put the --===============4083160071522644035==--