Skip to content

Commit

Permalink
Hardcode /bin/*sh redirector to /bin/bash
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-rann committed Sep 23, 2024
1 parent 065d2b4 commit e195cc8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/engines/bash-execve-redirector.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ int execve(const char *filename, char * const argv[], char * const envp[])
&& (strstr(startBytes, "/bin/sh") != NULL || strstr(startBytes, "/bin/bash") != NULL
|| strstr(startBytes, "/bin/ash") != NULL || strstr(startBytes, "/bin/dash") != NULL ))
{
char *bashExec = "/bin/bash";
char **replacementArgv;
unsigned i = 0;

Expand All @@ -63,15 +64,15 @@ int execve(const char *filename, char * const argv[], char * const envp[])
unsigned arg = 0;

replacementArgv = malloc(sizeof(char*) * (i + 4));
replacementArgv[arg++] = strdup(kcovBash);
replacementArgv[arg++] = strdup(bashExec);
if (!kcovUseDebugTrap)
replacementArgv[arg++] = strdup(bashArg);
replacementArgv[arg++] = strdup(filename);
for (i = 0; argv[i]; i++)
replacementArgv[i + arg] = strdup(argv[i]);
replacementArgv[i + arg] = NULL;

filename = strdup(kcovBash);
filename = strdup(bashExec);

argv = replacementArgv;
}
Expand Down

0 comments on commit e195cc8

Please sign in to comment.