Merge branch 'sorted_showmap' into dev

This commit is contained in:
Dominik Maier 2021-05-22 11:36:30 +02:00
commit 1fe06d3856
2 changed files with 18 additions and 10 deletions

1
.gitignore vendored
View File

@ -85,3 +85,4 @@ gmon.out
afl-frida-trace.so afl-frida-trace.so
utils/afl_network_proxy/afl-network-client utils/afl_network_proxy/afl-network-client
utils/afl_network_proxy/afl-network-server utils/afl_network_proxy/afl-network-server
*.o.tmp

View File

@ -52,6 +52,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
#include <dirent.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/time.h> #include <sys/time.h>
#ifndef USEMMAP #ifndef USEMMAP
@ -1130,7 +1131,8 @@ int main(int argc, char **argv_orig, char **envp) {
if (in_dir) { if (in_dir) {
DIR * dir_in, *dir_out = NULL; DIR * dir_in, *dir_out = NULL;
struct dirent *dir_ent; struct dirent **file_list;
// int done = 0; // int done = 0;
u8 infile[PATH_MAX], outfile[PATH_MAX]; u8 infile[PATH_MAX], outfile[PATH_MAX];
u8 wait_for_gdb = 0; u8 wait_for_gdb = 0;
@ -1155,12 +1157,6 @@ int main(int argc, char **argv_orig, char **envp) {
ck_free(dn); ck_free(dn);
if (!be_quiet) ACTF("Reading from directory '%s'...", in_dir); if (!be_quiet) ACTF("Reading from directory '%s'...", in_dir);
if (!(dir_in = opendir(in_dir))) {
PFATAL("cannot open directory %s", in_dir);
}
if (!collect_coverage) { if (!collect_coverage) {
if (!(dir_out = opendir(out_file))) { if (!(dir_out = opendir(out_file))) {
@ -1246,7 +1242,16 @@ int main(int argc, char **argv_orig, char **envp) {
if (fsrv->support_shmem_fuzz && !fsrv->use_shmem_fuzz) if (fsrv->support_shmem_fuzz && !fsrv->use_shmem_fuzz)
shm_fuzz = deinit_shmem(fsrv, shm_fuzz); shm_fuzz = deinit_shmem(fsrv, shm_fuzz);
while ((dir_ent = readdir(dir_in))) { int file_count = scandir(in_dir, &file_list, NULL, alphasort);
if (file_count < 0) {
PFATAL("Failed to read from input dir at %s\n", in_dir);
}
for (int i = 0; i < file_count; i++) {
struct dirent *dir_ent = file_list[i];
if (dir_ent->d_name[0] == '.') { if (dir_ent->d_name[0] == '.') {
@ -1293,9 +1298,11 @@ int main(int argc, char **argv_orig, char **envp) {
} }
free(file_list);
file_list = NULL;
if (!quiet_mode) { OKF("Processed %llu input files.", fsrv->total_execs); } if (!quiet_mode) { OKF("Processed %llu input files.", fsrv->total_execs); }
closedir(dir_in);
if (dir_out) { closedir(dir_out); } if (dir_out) { closedir(dir_out); }
if (collect_coverage) { if (collect_coverage) {