Skip to content

Commit

Permalink
Fix hijack to actually call the hijacked executable no matter where i…
Browse files Browse the repository at this point in the history
…t is called.

Change-Id: Ic2b291240112f9d67a9e327afcfe9210b21c9211
  • Loading branch information
dmorgan81 committed Aug 8, 2011
1 parent edd81df commit b3b812a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions hijack/hijack.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ hijack_log(" Executing log dumper script:");
hijack_log(" exec(\"%s %s\") executing...", LOG_DUMP_BINARY, LOG_PATH);
result = exec_and_wait(log_dump_args);
hijack_log(" returned: %d", result);

#endif

// check to see if hijack was already run, and if so, just continue on.
Expand Down Expand Up @@ -319,8 +318,11 @@ hijack_log(" returned: %d", result);
}
}

char hijacked_executable_fullpath[PATH_MAX];
readlink("/proc/self/exe", hijacked_executable_fullpath, sizeof(hijacked_executable_fullpath));

char real_executable[PATH_MAX];
sprintf(real_executable, "%s.bin", hijacked_executable);
sprintf(real_executable, "%s/%s.bin", dirname(hijacked_executable_fullpath), basename(hijacked_executable));
char ** argp = (char **)malloc(sizeof(char *) * (argc + 1));
for (i = 0; i < argc; i++) {
argp[i]=argv[i];
Expand Down
2 changes: 1 addition & 1 deletion hijack/hijack.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int exec_and_wait(char ** argp);
int remount_root(const char * hijack_exec, int rw);
int hijack_mount(const char * hijack_exec, const char * dev, const char * mount_point);
int hijack_umount(const char * hijack_exec, const char * mount_point);
void hijacK_log(char * format, ...);
void hijack_log(char * format, ...);
int mark_file(char * filename);

#endif

0 comments on commit b3b812a

Please sign in to comment.