diff options
author | van Hauser <vh@thc.org> | 2021-03-24 11:25:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-24 11:25:33 +0100 |
commit | f0e08e648609e57732a76e285e57714c6d5fd2cd (patch) | |
tree | 9d35021985e2b6ea2b2988f318195d238e6fabc3 /test/test-dlopen.c | |
parent | 37829765282421d9e3cb9448bceedcb58256e76a (diff) | |
parent | 2dac4e785fa9f27e8c59bb504cfa8942eba938be (diff) | |
download | afl++-f0e08e648609e57732a76e285e57714c6d5fd2cd.tar.gz |
Merge pull request #842 from AFLplusplus/stable
3.12c release
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); + +} + |