diff options
author | hexcoder- <heiko@hexco.de> | 2024-10-19 13:54:48 +0200 |
---|---|---|
committer | hexcoder- <heiko@hexco.de> | 2024-10-19 13:54:48 +0200 |
commit | 8a060a4b68a0aa1c812916bcbcf4bf3424854124 (patch) | |
tree | 2d03bc1c851878476a29aba273200121152d3ba6 | |
parent | a11488b9dcc71e5b52876e8c11ea6ee231e433ba (diff) | |
download | afl++-8a060a4b68a0aa1c812916bcbcf4bf3424854124.tar.gz |
fix the cleanup of previous generated SHA1 files in function handle_existing_out_dir()
-rw-r--r-- | src/afl-fuzz-init.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/afl-fuzz-init.c b/src/afl-fuzz-init.c index a9397232..af6e6d4c 100644 --- a/src/afl-fuzz-init.c +++ b/src/afl-fuzz-init.c @@ -1714,13 +1714,15 @@ static u8 delete_files(u8 *path, u8 *prefix) { while ((d_ent = readdir(d))) { - if (d_ent->d_name[0] != '.' && - (!prefix || !strncmp(d_ent->d_name, prefix, strlen(prefix)))) { + if ((d_ent->d_name[0] != '.' && + (!prefix || !strncmp(d_ent->d_name, prefix, strlen(prefix)))) + /* heiko: don't forget the SHA1 files */ + || strspn(d_ent->d_name, "0123456789abcdef") == 2 * 20 /* TODO use 2 * HASH_LENGTH */ + ) { u8 *fname = alloc_printf("%s/%s", path, d_ent->d_name); if (unlink(fname)) { PFATAL("Unable to delete '%s'", fname); } ck_free(fname); - } } |