diff options
author | Rumata888 <isennovskiy@gmail.com> | 2020-11-17 12:00:06 +0300 |
---|---|---|
committer | Rumata888 <isennovskiy@gmail.com> | 2020-11-17 12:00:06 +0300 |
commit | 9d22c8a02ca9043e62c250a32d5affdaeab11dcd (patch) | |
tree | 6b1d2346c66d123eda500dbdcc19a629a82ae245 /custom_mutators/symcc | |
parent | 622f942555772c9d15569ecdd77a67d1a2f6bd78 (diff) | |
download | afl++-9d22c8a02ca9043e62c250a32d5affdaeab11dcd.tar.gz |
Fixed fd leak on early exit and closed pipes before early exits and PFATAL
Diffstat (limited to 'custom_mutators/symcc')
-rw-r--r-- | custom_mutators/symcc/symcc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/custom_mutators/symcc/symcc.c b/custom_mutators/symcc/symcc.c index 54a7fbb0..acec29da 100644 --- a/custom_mutators/symcc/symcc.c +++ b/custom_mutators/symcc/symcc.c @@ -142,8 +142,14 @@ void afl_custom_queue_new_entry(my_mutator_t * data, ssize_t r = read(fd, data->mutator_buf, MAX_FILE); DBG("fn=%s, fd=%d, size=%ld\n", fn, fd, r); ck_free(fn); - if (r <= 0) return; close(fd); + if (r <= 0) { + + close(pipefd[1]); + return; + + } + if (r > fcntl(pipefd[1], F_GETPIPE_SZ)) fcntl(pipefd[1], F_SETPIPE_SZ, MAX_FILE); ck_write(pipefd[1], data->mutator_buf, r, filename_new_queue); @@ -151,7 +157,7 @@ void afl_custom_queue_new_entry(my_mutator_t * data, } else { ck_free(fn); - + close(pipefd[1]); PFATAL( "Something happened to the enqueued file before sending its " "contents to symcc binary"); |