about summary refs log tree commit diff
path: root/src/afl-forkserver.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/afl-forkserver.c')
-rw-r--r--src/afl-forkserver.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/afl-forkserver.c b/src/afl-forkserver.c
index df300950..04195d00 100644
--- a/src/afl-forkserver.c
+++ b/src/afl-forkserver.c
@@ -968,7 +968,7 @@ void afl_fsrv_write_to_testcase(afl_forkserver_t *fsrv, u8 *buf, size_t len) {
 
     s32 fd = fsrv->out_fd;
 
-    if (!fsrv->use_stdin) {
+    if (!fsrv->use_stdin && fsrv->out_file) {
 
       if (fsrv->no_unlink) {
 
@@ -983,6 +983,11 @@ void afl_fsrv_write_to_testcase(afl_forkserver_t *fsrv, u8 *buf, size_t len) {
 
       if (fd < 0) { PFATAL("Unable to create '%s'", fsrv->out_file); }
 
+    } else if (unlikely(!fd)) {
+      
+      // We should never have stdin as fd here, 0 is likely unset.
+      FATAL("Nowhere to write output to (neither out_fd nor out_file set)");
+
     } else {
 
       lseek(fd, 0, SEEK_SET);