mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-08 10:50:28 +00:00
sysv execve remove resource-leaking zipos APE proof of concept
This commit is contained in:
parent
20b75864e6
commit
c235065608
2 changed files with 0 additions and 19 deletions
|
@ -85,13 +85,6 @@ int sys_execve(const char *prog, char *const argv[], char *const envp[]) {
|
|||
newprog = alloca(PATH_MAX);
|
||||
fd = _weaken(__zipos_uri_to_mem_file)(&uri, newprog);
|
||||
prog = newprog;
|
||||
if ((fd != -1) && IsApeBinary(prog)) {
|
||||
flags = fcntl(fd, F_GETFD);
|
||||
if (flags != -1) {
|
||||
fcntl(fd, F_SETFD, flags & (~FD_CLOEXEC));
|
||||
flags = fcntl(fd, F_GETFD);
|
||||
}
|
||||
}
|
||||
} else if (IsFreebsd()) {
|
||||
if ((fd = _weaken(__zipos_uri_to_mem_file)(&uri, NULL)) != -1) {
|
||||
return sys_fexecve(fd, argv, envp);
|
||||
|
|
|
@ -72,15 +72,3 @@ TEST(execve, ziposELF) {
|
|||
notpossible;
|
||||
EXITS(42);
|
||||
}
|
||||
|
||||
TEST(execve, ziposAPE) {
|
||||
if (!IsLinux()) {
|
||||
EXPECT_EQ(-1, execve("/zip/life-nomod.com", (char *const[]){0},
|
||||
(char *const[]){0}));
|
||||
return;
|
||||
}
|
||||
SPAWN(fork);
|
||||
execve("/zip/life-nomod.com", (char *const[]){0}, (char *const[]){0});
|
||||
notpossible;
|
||||
EXITS(42);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue