about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2020-10-20 20:48:33 +0200
committerAndrea Fioraldi <andreafioraldi@gmail.com>2020-10-20 20:48:33 +0200
commit982260c134e7b373a6ec102fe2ef9904d342fa20 (patch)
tree248a29ef0776bc24c47ed8e2febabd159817b9dd /src
parentfa191017b51d7ac4470b4a0a03d6cf4e539f8883 (diff)
downloadafl++-982260c134e7b373a6ec102fe2ef9904d342fa20.tar.gz
fix timeout bug in read_s32_timed on non linux OSes
Diffstat (limited to 'src')
-rw-r--r--src/afl-forkserver.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c
index 33b16817..df300950 100644
--- a/src/afl-forkserver.c
+++ b/src/afl-forkserver.c
@@ -140,7 +140,7 @@ read_s32_timed(s32 fd, s32 *buf, u32 timeout_ms, volatile u8 *stop_soon_p) {
   timeout.tv_sec = (timeout_ms / 1000);
   timeout.tv_usec = (timeout_ms % 1000) * 1000;
 #if !defined(__linux__)
-  u64 read_start = get_cur_time_us();
+  u32 read_start = get_cur_time_us();
 #endif
 
   /* set exceptfds as well to return when a child exited/closed the pipe. */
@@ -166,7 +166,7 @@ restart_select:
           timeout_ms,
           ((u64)timeout_ms - (timeout.tv_sec * 1000 + timeout.tv_usec / 1000)));
 #else
-      u32 exec_ms = MIN(timeout_ms, get_cur_time_us() - read_start);
+      u32 exec_ms = MIN(timeout_ms, (get_cur_time_us() - read_start) / 1000);
 #endif
 
       // ensure to report 1 ms has passed (0 is an error)