mirror of
https://github.com/systemd/systemd.git
synced 2026-11-06 21:36:59 +00:00
glibc's execvp() and friends run the file via /bin/sh when execve() fails with ENOEXEC, hence a truncated or otherwise broken binary is run as an empty shell script and exits successfully. Let's use execvp_safe() and execvpe_safe() everywhere, so that such binaries fail with ENOEXEC. Note that this means that scripts without a shebang line are not run via /bin/sh anymore, e.g. when specified via $SYSTEMD_EDITOR or $PAGER or passed to systemd-run. Also, relative and empty $PATH entries are ignored, as find_executable() always did. musl's execvp() doesn't run scripts via /bin/sh either.