mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-14 19:08:08 +00:00
minor fix to qemu_persistent_hook example
This commit is contained in:
@ -38,12 +38,13 @@ enum {
|
|||||||
void afl_persistent_hook(uint64_t *regs, uint64_t guest_base) {
|
void afl_persistent_hook(uint64_t *regs, uint64_t guest_base) {
|
||||||
|
|
||||||
// In this example the register RDI is pointing to the memory location
|
// 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]);
|
printf("reading into %p\n", regs[R_EDI]);
|
||||||
size_t r = read(0, g2h(regs[R_EDI]), 1024);
|
size_t r = read(0, g2h(regs[R_EDI]), 1024);
|
||||||
regs[R_EAX] = r;
|
regs[R_ESI] = r;
|
||||||
printf("readed %ld bytes\n", r);
|
printf("read %ld bytes\n", r);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <stdio.h>
|
#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);
|
printf("buffer:%p, size:%p\n", buf, size);
|
||||||
switch (buf[0]) {
|
switch (buf[0]) {
|
||||||
|
Reference in New Issue
Block a user