diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/qemu_persistent_hook/read_into_rdi.c | 7 | ||||
-rw-r--r-- | examples/qemu_persistent_hook/test.c | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/examples/qemu_persistent_hook/read_into_rdi.c b/examples/qemu_persistent_hook/read_into_rdi.c index 43f1758f..6cf66ddf 100644 --- a/examples/qemu_persistent_hook/read_into_rdi.c +++ b/examples/qemu_persistent_hook/read_into_rdi.c @@ -38,12 +38,13 @@ enum { void afl_persistent_hook(uint64_t *regs, uint64_t guest_base) { // In this example the register RDI is pointing to the memory location - // of the target buffer, and the length of the input is in RAX. + // 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") printf("reading into %p\n", regs[R_EDI]); size_t r = read(0, g2h(regs[R_EDI]), 1024); - regs[R_EAX] = r; - printf("readed %ld bytes\n", r); + regs[R_ESI] = r; + printf("read %ld bytes\n", r); } diff --git a/examples/qemu_persistent_hook/test.c b/examples/qemu_persistent_hook/test.c index 83001545..f6672027 100644 --- a/examples/qemu_persistent_hook/test.c +++ b/examples/qemu_persistent_hook/test.c @@ -1,6 +1,6 @@ #include <stdio.h> -int target_func(char *buf, int size) { +int target_func(unsigned char *buf, int size) { printf("buffer:%p, size:%p\n", buf, size); switch (buf[0]) { |