about summary refs log tree commit diff
path: root/test-instr.c
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2023-05-17 15:25:26 +0200
committervanhauser-thc <vh@thc.org>2023-05-17 15:25:26 +0200
commit1d0694df86a3ce70ffac2846f36605eac9300abe (patch)
treec77f4514b2dd1026a245ccd38f8e2683cad0aa63 /test-instr.c
parentdfdc6fd12cdae1fe2dab1183f20d3c312a7f2f6d (diff)
downloadafl++-1d0694df86a3ce70ffac2846f36605eac9300abe.tar.gz
add symqemu custom mutator
Diffstat (limited to 'test-instr.c')
-rw-r--r--test-instr.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/test-instr.c b/test-instr.c
index 1d9f2e6e..eda5189c 100644
--- a/test-instr.c
+++ b/test-instr.c
@@ -24,7 +24,7 @@
 
 int main(int argc, char **argv) {
 
-  int   fd = 0;
+  int   fd = 0, cnt;
   char  buff[8];
   char *buf = buff;
 
@@ -32,7 +32,6 @@ int main(int argc, char **argv) {
   if (argc == 2) {
 
     buf = argv[1];
-    printf("Input %s - ", buf);
 
   } else {
 
@@ -47,15 +46,19 @@ int main(int argc, char **argv) {
 
     }
 
-    if (read(fd, buf, sizeof(buf)) < 1) {
+    if ((cnt = read(fd, buf, sizeof(buf) - 1)) < 1) {
 
       printf("Hum?\n");
       return 1;
 
     }
 
+    buf[cnt] = 0;
+
   }
 
+  if (getenv("AFL_DEBUG")) fprintf(stderr, "test-instr: %s\n", buf);
+
   // we support three input cases (plus a 4th if stdin is used but there is no
   // input)
   switch (buf[0]) {