Skip to content

Commit

Permalink
Merge pull request #436 from cvspvr/master
Browse files Browse the repository at this point in the history
allow the winafl.dll path to be specified by -w in afl-tmin.exe
  • Loading branch information
ifratric committed Apr 9, 2024
2 parents 4e08dbc + 8c95ec4 commit 580e8ba
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions afl-tmin.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ static HANDLE child_handle,
child_thread_handle;
static char *dynamorio_dir;
static char *client_params;
static char *winafl_dll_path;
static const char *winafl_dll_path_default = "winafl.dll";
int fuzz_iterations_max = 1, fuzz_iterations_current;

static CRITICAL_SECTION critical_section;
Expand Down Expand Up @@ -487,9 +489,12 @@ static void create_target_process(char** argv) {
ck_free(static_config);
} else {
pidfile = alloc_printf("childpid_%s.txt", fuzzer_id);
if (winafl_dll_path == NULL) {
winafl_dll_path = winafl_dll_path_default;
}
cmd = alloc_printf(
"%s\\drrun.exe -pidfile %s -no_follow_children -c winafl.dll %s -fuzz_iterations 1 -fuzzer_id %s -- %s",
dynamorio_dir, pidfile, client_params, fuzzer_id, target_cmd
"%s\\drrun.exe -pidfile %s -no_follow_children -c %s %s -fuzz_iterations 1 -fuzzer_id %s -- %s",
dynamorio_dir, pidfile, winafl_dll_path, client_params, fuzzer_id, target_cmd
);
}

Expand Down Expand Up @@ -1352,6 +1357,7 @@ int main(int argc, char** argv) {
optind = 1;
dynamorio_dir = NULL;
client_params = NULL;
winafl_dll_path = NULL;

#ifdef USE_COLOR
enable_ansi_console();
Expand All @@ -1361,7 +1367,7 @@ int main(int argc, char** argv) {
SAYF("Based on WinAFL " cBRI VERSION cRST " by <[email protected]>\n");
SAYF("Based on AFL " cBRI VERSION cRST " by <[email protected]>\n");

while ((opt = getopt(argc,argv,"+i:o:f:m:t:B:D:l:xeQYVNMS")) > 0)
while ((opt = getopt(argc,argv,"+i:o:w:f:m:t:B:D:l:xeQYVNMS")) > 0)

switch (opt) {

Expand Down Expand Up @@ -1389,6 +1395,12 @@ int main(int argc, char** argv) {
}
break;

case 'w': /* winafl.dll path */

if (winafl_dll_path) FATAL("Multiple -w options not supported");
winafl_dll_path = optarg;
break;

case 'f':

if (prog_in) FATAL("Multiple -f options not supported");
Expand Down

0 comments on commit 580e8ba

Please sign in to comment.