mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-23 06:28:51 +00:00
Don't crash for unset out_file (fixed #562)
This commit is contained in:
@ -968,7 +968,7 @@ void afl_fsrv_write_to_testcase(afl_forkserver_t *fsrv, u8 *buf, size_t len) {
|
|||||||
|
|
||||||
s32 fd = fsrv->out_fd;
|
s32 fd = fsrv->out_fd;
|
||||||
|
|
||||||
if (!fsrv->use_stdin) {
|
if (!fsrv->use_stdin && fsrv->out_file) {
|
||||||
|
|
||||||
if (fsrv->no_unlink) {
|
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); }
|
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 {
|
} else {
|
||||||
|
|
||||||
lseek(fd, 0, SEEK_SET);
|
lseek(fd, 0, SEEK_SET);
|
||||||
|
Reference in New Issue
Block a user