about summary refs log tree commit diff
path: root/src/afl-fuzz-run.c
diff options
context:
space:
mode:
authorAndrea Fioraldi <andreafioraldi@gmail.com>2019-11-11 14:36:06 +0100
committerGitHub <noreply@github.com>2019-11-11 14:36:06 +0100
commit659db7e421b47da4b04110a141d9c20307f74ecc (patch)
tree18f9c38cc5270adcf445a62b974712cead4a01c4 /src/afl-fuzz-run.c
parentcd84339bccc104a51a5da614a9f82cc4ae615cce (diff)
parent01d55372441960c435af8f3bd6b61d1302042728 (diff)
downloadafl++-659db7e421b47da4b04110a141d9c20307f74ecc.tar.gz
Merge branch 'master' into radamsa
Diffstat (limited to 'src/afl-fuzz-run.c')
-rw-r--r--src/afl-fuzz-run.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/afl-fuzz-run.c b/src/afl-fuzz-run.c
index 46d12423..e12b06eb 100644
--- a/src/afl-fuzz-run.c
+++ b/src/afl-fuzz-run.c
@@ -2,7 +2,7 @@
    american fuzzy lop++ - target execution related routines
    --------------------------------------------------------
 
-   Originally written by Michal Zalewski <lcamtuf@google.com>
+   Originally written by Michal Zalewski
 
    Now maintained by by Marc Heuse <mh@mh-sec.de>,
                         Heiko Eißfeldt <heiko.eissfeldt@hexco.de> and
@@ -288,10 +288,9 @@ void write_to_testcase(void* mem, u32 len) {
 
   if (out_file) {
 
-    // unlink(out_file);                                     /* Ignore errors.
-    // */
+    unlink(out_file);                                     /* Ignore errors. */
 
-    fd = open(out_file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+    fd = open(out_file, O_WRONLY | O_CREAT | O_EXCL, 0600);
 
     if (fd < 0) PFATAL("Unable to create '%s'", out_file);
 
@@ -331,10 +330,9 @@ void write_with_gap(void* mem, u32 len, u32 skip_at, u32 skip_len) {
 
   if (out_file) {
 
-    // unlink(out_file);                                     /* Ignore errors.
-    // */
+    unlink(out_file);                                     /* Ignore errors. */
 
-    fd = open(out_file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+    fd = open(out_file, O_WRONLY | O_CREAT | O_EXCL, 0600);
 
     if (fd < 0) PFATAL("Unable to create '%s'", out_file);