about summary refs log tree commit diff
path: root/examples/custom_mutators/example.c
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-03-26 19:48:26 +0100
committervan Hauser <vh@thc.org>2020-03-27 11:06:06 +0100
commit932eae7343c59aee7ade950e5e233ac71acaf745 (patch)
tree8693ae2f34734310b529eb16cc8715038debf876 /examples/custom_mutators/example.c
parent604f122819bbcba6a041b4b471805a3b586916cc (diff)
downloadafl++-932eae7343c59aee7ade950e5e233ac71acaf745.tar.gz
example fixed
Diffstat (limited to 'examples/custom_mutators/example.c')
-rw-r--r--examples/custom_mutators/example.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/examples/custom_mutators/example.c b/examples/custom_mutators/example.c
index 220d0ca1..8a45d87f 100644
--- a/examples/custom_mutators/example.c
+++ b/examples/custom_mutators/example.c
@@ -149,14 +149,15 @@ size_t afl_custom_pre_save(my_mutator_t *data, uint8_t *buf, size_t buf_size,
     data->pre_save_size = buf_size + 5;
 
   }
-
-  memcpy(out_buf + 5, buf, buf_size);
-  out_buf_size = buf_size + 5;
-  out_buf[0] = 'A';
-  out_buf[1] = 'F';
-  out_buf[2] = 'L';
-  out_buf[3] = '+';
-  out_buf[4] = '+';
+  *out_buf = data->pre_save_buf;
+
+  memcpy(*out_buf + 5, buf, buf_size);
+  size_t out_buf_size = buf_size + 5;
+  *out_buf[0] = 'A';
+  *out_buf[1] = 'F';
+  *out_buf[2] = 'L';
+  *out_buf[3] = '+';
+  *out_buf[4] = '+';
 
   return out_buf_size;