minor fix to qemu_persistent_hook example
diff --git a/examples/qemu_persistent_hook/read_into_rdi.c b/examples/qemu_persistent_hook/read_into_rdi.c
index 43f1758..6cf66dd 100644
--- a/examples/qemu_persistent_hook/read_into_rdi.c
+++ b/examples/qemu_persistent_hook/read_into_rdi.c
@@ -38,12 +38,13 @@
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 8300154..f667202 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]) {