minor fix to qemu_persistent_hook example

This commit is contained in:
van Hauser
2020-03-17 16:10:34 +01:00
parent e194acdd79
commit dae249dc71
2 changed files with 5 additions and 4 deletions

View File

@ -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);
}

View File

@ -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]) {