diff options
author | vanhauser-thc <vh@thc.org> | 2021-04-30 23:41:06 +0200 |
---|---|---|
committer | vanhauser-thc <vh@thc.org> | 2021-04-30 23:41:06 +0200 |
commit | 86452cc959bd4b0d5fe6e60d0eefbc7848fe38e2 (patch) | |
tree | 4828130832f7fd531cdacc2887f2da636fdcc9c0 /src/afl-fuzz-run.c | |
parent | f4cc718fdc4571f56280a1efad3645125bee2154 (diff) | |
download | afl++-86452cc959bd4b0d5fe6e60d0eefbc7848fe38e2.tar.gz |
fix stdin trimming
Diffstat (limited to 'src/afl-fuzz-run.c')
-rw-r--r-- | src/afl-fuzz-run.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/afl-fuzz-run.c b/src/afl-fuzz-run.c index a7b071a5..397d62bf 100644 --- a/src/afl-fuzz-run.c +++ b/src/afl-fuzz-run.c @@ -203,7 +203,7 @@ static void write_with_gap(afl_state_t *afl, u8 *mem, u32 len, u32 skip_at, } - if (afl->fsrv.shmem_fuzz) { + if (likely(afl->fsrv.use_shmem_fuzz)) { if (!post_process_skipped) { @@ -211,9 +211,7 @@ static void write_with_gap(afl_state_t *afl, u8 *mem, u32 len, u32 skip_at, memcpy(afl->fsrv.shmem_fuzz, new_mem, new_size); - } - - else { + } else { memcpy(afl->fsrv.shmem_fuzz, mem, skip_at); @@ -244,7 +242,7 @@ static void write_with_gap(afl_state_t *afl, u8 *mem, u32 len, u32 skip_at, return; - } else if (afl->fsrv.out_file) { + } else if (unlikely(!afl->fsrv.use_stdin)) { if (unlikely(afl->no_unlink)) { @@ -279,7 +277,7 @@ static void write_with_gap(afl_state_t *afl, u8 *mem, u32 len, u32 skip_at, } - if (!afl->fsrv.out_file) { + if (afl->fsrv.use_stdin) { if (ftruncate(fd, new_size)) { PFATAL("ftruncate() failed"); } lseek(fd, 0, SEEK_SET); |