diff options
-rw-r--r-- | loader/loader.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/loader/loader.c b/loader/loader.c index 53a2c38..ebcdbfe 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -34,6 +34,12 @@ #error LOADER must be defined #endif +void usage(void) +{ + printf("This is the gcompat ELF interpreter stub.\n"); + printf("You are not meant to run this directly.\n"); +} + /* * Given the argv { "foo", "bar", "baz" }, and the environment variable * "LD_PRELOAD=/another/preload.so", the new argv will be { @@ -96,6 +102,12 @@ int main(int argc, char *argv[], char *envp[]) } target[len] = '\0'; + /* somebody is trying to run the loader directly */ + if (strstr(target, LOADER) != NULL) { + usage(); + return EXIT_FAILURE; + } + new_argv[0] = LOADER; new_argv[1] = "--argv0"; new_argv[2] = argv[0]; |