aboutsummaryrefslogtreecommitdiff
path: root/libtokencap/libtokencap.so.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-06-29 18:36:06 +0200
committerGitHub <noreply@github.com>2020-06-29 18:36:06 +0200
commitfc5cfc6cb309b072a45b991be117c17396e46a89 (patch)
tree4c762f1e2cfb4a8741c08b5b60d07c2ae8eee860 /libtokencap/libtokencap.so.c
parent76a2d9b59b23873c8a6d174a2f3c48eba60712fb (diff)
parent6d9b29daca46c8912aa9ddf6c053bc8554e9e9f7 (diff)
downloadafl++-fc5cfc6cb309b072a45b991be117c17396e46a89.tar.gz
Merge pull request #428 from AFLplusplus/dev
Dev
Diffstat (limited to 'libtokencap/libtokencap.so.c')
-rw-r--r--libtokencap/libtokencap.so.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/libtokencap/libtokencap.so.c b/libtokencap/libtokencap.so.c
index 5a7cf3aa..600d2a5d 100644
--- a/libtokencap/libtokencap.so.c
+++ b/libtokencap/libtokencap.so.c
@@ -33,8 +33,9 @@
#include "../types.h"
#include "../config.h"
-#if !defined __linux__ && !defined __APPLE__ && !defined __FreeBSD__ && \
- !defined __OpenBSD__ && !defined __NetBSD__ && !defined __DragonFly__
+#if !defined __linux__ && !defined __APPLE__ && !defined __FreeBSD__ && \
+ !defined __OpenBSD__ && !defined __NetBSD__ && !defined __DragonFly__ && \
+ !defined(__HAIKU__)
#error "Sorry, this library is unsupported in this platform for now!"
#endif /* !__linux__ && !__APPLE__ && ! __FreeBSD__ && ! __OpenBSD__ && \
!__NetBSD__*/
@@ -49,6 +50,8 @@
#include <sys/user.h>
#endif
#include <sys/mman.h>
+#elif defined __HAIKU__
+ #include <kernel/image.h>
#endif
#include <dlfcn.h>
@@ -230,6 +233,19 @@ static void __tokencap_load_mappings(void) {
}
munmap(buf, len);
+#elif defined __HAIKU__
+ image_info ii;
+ int32_t group = 0;
+
+ while (get_next_image_info(0, &group, &ii) == B_OK) {
+
+ __tokencap_ro[__tokencap_ro_cnt].st = ii.text;
+ __tokencap_ro[__tokencap_ro_cnt].en = ((char *)ii.text) + ii.text_size;
+
+ if (++__tokencap_ro_cnt == MAX_MAPPINGS) break;
+
+ }
+
#endif
}