about summary refs log tree commit diff
diff options
context:
space:
mode:
authoraflpp <aflpp@aflplus.plus>2021-03-01 19:15:58 +0100
committeraflpp <aflpp@aflplus.plus>2021-03-01 19:15:58 +0100
commitd0a61279b8306ea74de6f4a4a9cebbc7f559a4e1 (patch)
treeee2b03c30ba477b79c2c470be9013f1ce86d4d97
parent7259075b71924e7ab68546aca04fa5ecfe2d93d6 (diff)
downloadafl++-d0a61279b8306ea74de6f4a4a9cebbc7f559a4e1.tar.gz
write to correct pipe end
-rw-r--r--instrumentation/afl-compiler-rt.o.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c
index 15832793..1b21eea1 100644
--- a/instrumentation/afl-compiler-rt.o.c
+++ b/instrumentation/afl-compiler-rt.o.c
@@ -481,9 +481,9 @@ static void __afl_map_shm(void) {
 
   if (id_str) {
 
-    if ((__afl_dummy_fd[0] = open("/dev/null", O_WRONLY)) < 0) {
+    if ((__afl_dummy_fd[1] = open("/dev/null", O_WRONLY)) < 0) {
 
-      if (pipe(__afl_dummy_fd) < 0) { __afl_dummy_fd[0] = 1; }
+      if (pipe(__afl_dummy_fd) < 0) { __afl_dummy_fd[1] = 1; }
 
     }
 
@@ -1591,7 +1591,7 @@ static int area_is_valid(void *ptr, size_t len) {
 
   }
 
-  int r = syscall(__afl_dummy_fd[0], SYS_write, ptr, len);
+  int r = syscall(__afl_dummy_fd[1], SYS_write, ptr, len);
 
   if (r <= 0) {  //  maybe this is going over an asan boundary
 
@@ -1600,7 +1600,7 @@ static int area_is_valid(void *ptr, size_t len) {
     char *page = (char *)((uintptr_t)p & ~(page_size - 1)) + page_size;
     if (page < p + len) { return 0; }
     len -= (p + len - page);
-    r = syscall(__afl_dummy_fd[0], SYS_write, p, len);
+    r = syscall(__afl_dummy_fd[1], SYS_write, p, len);
 
   }