about summary refs log tree commit diff
path: root/utils/argv_fuzzing
diff options
context:
space:
mode:
Diffstat (limited to 'utils/argv_fuzzing')
-rw-r--r--utils/argv_fuzzing/argv-fuzz-inl.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/argv_fuzzing/argv-fuzz-inl.h b/utils/argv_fuzzing/argv-fuzz-inl.h
index c15c0271..e350dd4e 100644
--- a/utils/argv_fuzzing/argv-fuzz-inl.h
+++ b/utils/argv_fuzzing/argv-fuzz-inl.h
@@ -34,6 +34,7 @@
 #ifndef _HAVE_ARGV_FUZZ_INL
 #define _HAVE_ARGV_FUZZ_INL
 
+#include <stdlib.h>
 #include <unistd.h>
 
 #define AFL_INIT_ARGV()          \
@@ -63,7 +64,12 @@ static char **afl_init_argv(int *argc) {
   char *ptr = in_buf;
   int   rc = 0;
 
-  if (read(0, in_buf, MAX_CMDLINE_LEN - 2) < 0) {}
+  ssize_t num = read(0, in_buf, MAX_CMDLINE_LEN - 2);
+  if (num < 0) {
+      exit(1);
+  }
+  in_buf[num] = '\0';
+  in_buf[num + 1] = '\0';
 
   while (*ptr && rc < MAX_CMDLINE_PAR) {