diff options
author | Kenny Levinsen <kl@kl.wtf> | 2021-09-15 23:34:02 +0200 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2021-09-16 00:46:49 +0200 |
commit | 907b75de1ae5ec415a99889faecaf05b36bea31e (patch) | |
tree | 63a34969a56b87081245402ec0827472581ff786 /seatd-launch | |
parent | 4091ba2c07efde82a109fa8a07db77c814e90e5c (diff) | |
download | seatd-907b75de1ae5ec415a99889faecaf05b36bea31e.tar.xz |
seatd-launch: Use absolute path for seatd
We previously used execlp to execute seatd, which had the effect of
searching PATH for the executable. This allowed the caller to control
what executable was run, which is bad if SUID has been set.
Instead, expose the absolute install path for seatd from meason as a
define, and use that in a call to execv.
Diffstat (limited to 'seatd-launch')
-rw-r--r-- | seatd-launch/seatd-launch.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/seatd-launch/seatd-launch.c b/seatd-launch/seatd-launch.c index b9d33d7..7b41bb6 100644 --- a/seatd-launch/seatd-launch.c +++ b/seatd-launch/seatd-launch.c @@ -68,10 +68,11 @@ int main(int argc, char *argv[]) { } else if (seatd_child == 0) { close(fds[0]); - char pipebuf[8]; - sprintf(pipebuf, "%d", fds[1]); + char pipebuf[16] = {0}; + snprintf(pipebuf, sizeof pipebuf, "%d", fds[1]); - execlp("seatd", "seatd", "-n", pipebuf, "-s", sockpath, NULL); + char *command[] = {"seatd", "-n", pipebuf, "-s", sockpath, NULL}; + execv(SEATD_INSTALLPATH, command); perror("Could not start seatd"); _exit(1); } |