build: netfilter.c: replace system() with execv() (#7159)

This commit is contained in:
orbisai0security 2026-05-13 19:18:27 +05:30 committed by GitHub
parent f2df11ae37
commit 5b5952573f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -66,11 +66,12 @@ void netfilter_netlock(pid_t pid) {
env_apply_all();
umask(orig_umask);
char *cmd;
if (asprintf(&cmd, "%s -e \"%s/firejail/fnetlock --tail --log=%s\"", terminal, LIBDIR, flog) == -1)
char fnetlock_path[] = LIBDIR "/firejail/fnetlock";
char *log_arg;
if (asprintf(&log_arg, "--log=%s", flog) == -1)
errExit("asprintf");
int rv = system(cmd);
(void) rv;
char *exec_args[] = { terminal, "-e", fnetlock_path, "--tail", log_arg, NULL };
execv(terminal, exec_args);
exit(0);
}
}