aboutsummaryrefslogtreecommitdiff
path: root/libtokencap
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-06-23 15:08:49 +0200
committerDominik Maier <domenukk@gmail.com>2020-06-23 15:08:49 +0200
commitaad433e11efa4a8350a264313c66db8ef6d17088 (patch)
treea8249027f61f17e259e4a4ef6f2339e0394b1e35 /libtokencap
parentc1eb2bccaae8f5b31546e6af3b00583e46bd842b (diff)
parent59e1a18197b08b08ad9e75b23fb6a5c740a0b9dd (diff)
downloadafl++-aad433e11efa4a8350a264313c66db8ef6d17088.tar.gz
Merge branch 'dev' of github.com:vanhauser-thc/AFLplusplus into dev
Diffstat (limited to 'libtokencap')
-rw-r--r--libtokencap/Makefile9
-rw-r--r--libtokencap/libtokencap.so.c17
2 files changed, 21 insertions, 5 deletions
diff --git a/libtokencap/Makefile b/libtokencap/Makefile
index 75a8d337..63b87bb0 100644
--- a/libtokencap/Makefile
+++ b/libtokencap/Makefile
@@ -35,10 +35,11 @@ _UNIQ=_QINU_
_____OS_DL = $(____OS_DL:$(_UNIQ)$(UNAME_S)=)
______OS_DL = $(_____OS_DL:$(_UNIQ)="-ldl")
- _OS_TARGET = $(____OS_DL:$(_UNIQ)FreeBSD=$(_UNIQ))
- __OS_TARGET = $(_OS_TARGET:$(_UNIQ)OpenBSD=$(_UNIQ))
- ___OS_TARGET = $(__OS_TARGET:$(_UNIQ)NetBSD=$(_UNIQ))
-____OS_TARGET = $(___OS_TARGET:$(_UNIQ)$(UNAME_S)=)
+ _OS_TARGET = $(____OS_DL:$(_UNIQ)FreeBSD=$(_UNIQ))
+ __OS_TARGET = $(_OS_TARGET:$(_UNIQ)OpenBSD=$(_UNIQ))
+ ___OS_TARGET = $(__OS_TARGET:$(_UNIQ)NetBSD=$(_UNIQ))
+ ____OS_TARGET = $(___OS_TARGET:$(_UNIQ)Haiku=$(_UNIQ))
+_____OS_TARGET = $(___OS_TARGET:$(_UNIQ)$(UNAME_S)=)
TARGETS = $(____OS_TARGET:$(_UNIQ)=libtokencap.so)
diff --git a/libtokencap/libtokencap.so.c b/libtokencap/libtokencap.so.c
index 5a7cf3aa..88b5c041 100644
--- a/libtokencap/libtokencap.so.c
+++ b/libtokencap/libtokencap.so.c
@@ -34,7 +34,8 @@
#include "../config.h"
#if !defined __linux__ && !defined __APPLE__ && !defined __FreeBSD__ && \
- !defined __OpenBSD__ && !defined __NetBSD__ && !defined __DragonFly__
+ !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,18 @@ 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
}