diff options
author | van Hauser <vh@thc.org> | 2021-03-19 23:54:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-19 23:54:36 +0100 |
commit | 090128b3f8b8bc80cf47ae1481b01c0509dc6357 (patch) | |
tree | 03c3314427f02533a8db3e06587ce3afe74a5f23 /test/test-dlopen.c | |
parent | d7e121e2c99c02d4b6984f21ba837d44bce9c77c (diff) | |
parent | 749b03d812b76746b4a673f34a13fb0b067fd61d (diff) | |
download | afl++-090128b3f8b8bc80cf47ae1481b01c0509dc6357.tar.gz |
Merge branch 'dev' into dev
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); + +} + |