Skip to content

Commit ed15530

Browse files
committed
opkrun: Drop privileges before running program
This permits the opkrun binary to have the suid bit without presenting a risk for security. Signed-off-by: Paul Cercueil <[email protected]>
1 parent 8535321 commit ed15530

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

opkrun.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ int main(int argc, char **argv)
354354

355355
pid_t son = fork();
356356
if (!son) {
357+
/* Drop privileges */
358+
seteuid(getuid());
359+
357360
if (!access(args[0], X_OK)) /* Not in the root of the OPK */
358361
execv(args[0], args); /* Maybe in the $PATH? */
359362
execvp(args[0], args);

0 commit comments

Comments
 (0)