diff options
author | van Hauser <vh@thc.org> | 2021-03-19 19:04:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-19 19:04:59 +0100 |
commit | e98cd008222aa3bfea9b696ad756163302437eb3 (patch) | |
tree | 56cce5a15206634bd1877c428a5b15c064d7fa53 /test/test-dlopen.c | |
parent | 23f7bee81c46ad4f0f65fa56d08064ab5f1e2e6f (diff) | |
parent | 2102264acf5c271b7560a82771b3af8136af9354 (diff) | |
download | afl++-e98cd008222aa3bfea9b696ad756163302437eb3.tar.gz |
Merge pull request #831 from AFLplusplus/dev
Push to stable
Diffstat (limited to 'test/test-dlopen.c')
-rw-r--r-- | test/test-dlopen.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test-dlopen.c b/test/test-dlopen.c new file mode 100644 index 00000000..d08d9092 --- /dev/null +++ b/test/test-dlopen.c @@ -0,0 +1,23 @@ +#include <stdio.h> +#include <errno.h> +#include <dlfcn.h> +#include <stdlib.h> + +int main(int argc, char **argv) { + + if (!getenv("TEST_DLOPEN_TARGET")) return 1; + void *lib = dlopen(getenv("TEST_DLOPEN_TARGET"), RTLD_LAZY); + if (!lib) { + + perror(dlerror()); + return 2; + + } + + int (*func)(int, char **) = dlsym(lib, "main_exported"); + if (!func) return 3; + + return func(argc, argv); + +} + |