aboutsummaryrefslogtreecommitdiff
path: root/utils/aflpp_driver
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-04-28 10:59:34 +0200
committervanhauser-thc <vh@thc.org>2021-04-28 10:59:34 +0200
commitdde0538b484df627dac14ff030dd09f55c78558e (patch)
treedda2a4eee4079d9605c002429f8944cfcbb500d8 /utils/aflpp_driver
parent39ad3b89467d6de12cbb9d08ccd77d331c0d1f9e (diff)
downloadafl++-dde0538b484df627dac14ff030dd09f55c78558e.tar.gz
nits
Diffstat (limited to 'utils/aflpp_driver')
-rw-r--r--utils/aflpp_driver/aflpp_qemu_driver_hook.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/utils/aflpp_driver/aflpp_qemu_driver_hook.c b/utils/aflpp_driver/aflpp_qemu_driver_hook.c
index d3dd98b0..2979fadc 100644
--- a/utils/aflpp_driver/aflpp_qemu_driver_hook.c
+++ b/utils/aflpp_driver/aflpp_qemu_driver_hook.c
@@ -3,12 +3,12 @@
#include <stdint.h>
#include <string.h>
-void afl_persistent_hook(struct x86_64_regs *regs, uint64_t guest_base,
- uint8_t *input_buf, uint32_t input_buf_len) {
-
#define g2h(x) ((void *)((unsigned long)(x) + guest_base))
#define h2g(x) ((uint64_t)(x)-guest_base)
+void afl_persistent_hook(struct x86_64_regs *regs, uint64_t guest_base,
+ uint8_t *input_buf, uint32_t input_buf_len) {
+
// In this example the register RDI is pointing to the memory location
// of the target buffer, and the length of the input is in RSI.
// This can be seen with a debugger, e.g. gdb (and "disass main")
@@ -16,11 +16,11 @@ void afl_persistent_hook(struct x86_64_regs *regs, uint64_t guest_base,
memcpy(g2h(regs->rdi), input_buf, input_buf_len);
regs->rsi = input_buf_len;
+}
+
#undef g2h
#undef h2g
-}
-
int afl_persistent_hook_init(void) {
// 1 for shared memory input (faster), 0 for normal input (you have to use