Skip to content

Commit 1c58dc9

Browse files
Merge pull request #29 from R9295/main
fix forkserver sending message when not necessary
2 parents 4b4fdab + 41fbd28 commit 1c58dc9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

unicornafl.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -537,14 +537,13 @@ class UCAFL {
537537
/* Parent supports testcases via shared map - and the user wants to
538538
* use it. Tell AFL. */
539539
status = (FS_OPT_ENABLED | FS_OPT_SHDMEM_FUZZ);
540+
/* Phone home and tell the parent that we're OK. If parent isn't there,
541+
assume we're not running in forkserver mode and just execute
542+
program. */
543+
if (write(FORKSRV_FD + 1, &status, 4) != 4)
544+
return UC_AFL_RET_NO_AFL;
540545
}
541546

542-
/* Phone home and tell the parent that we're OK. If parent isn't there,
543-
assume we're not running in forkserver mode and just execute
544-
program. */
545-
546-
if (write(FORKSRV_FD + 1, &status, 4) != 4)
547-
return UC_AFL_RET_NO_AFL;
548547

549548
/* afl tells us in an extra message if it accepted this option or not */
550549
if (this->afl_testcase_ptr_ && getenv(SHM_FUZZ_ENV_VAR)) {

0 commit comments

Comments
 (0)