about summary refs log tree commit diff
path: root/src/afl-fuzz-extras.c
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2024-02-22 10:47:53 -0500
committerSean McBride <sean@rogue-research.com>2024-02-26 14:07:49 -0500
commitb2b887d04decdcdadf702c585bb1992a0a821bf1 (patch)
tree9fcdee4357b3b9adcbc5c394b3a668ca423840fb /src/afl-fuzz-extras.c
parent340d6aa97cd8fa18e8c7650ac9067e1b2688e8bb (diff)
downloadafl++-b2b887d04decdcdadf702c585bb1992a0a821bf1.tar.gz
Issue #2007: add filename extension to /crashes files
This is very helpful for code that inpects a file name extension when determining what code to run.

It's also useful for applications that constrain the user to choose files by extension.
Diffstat (limited to 'src/afl-fuzz-extras.c')
-rw-r--r--src/afl-fuzz-extras.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/afl-fuzz-extras.c b/src/afl-fuzz-extras.c
index 3b1d13f1..5735db0c 100644
--- a/src/afl-fuzz-extras.c
+++ b/src/afl-fuzz-extras.c
@@ -743,7 +743,10 @@ void save_auto(afl_state_t *afl) {
   for (i = 0; i < MIN((u32)USE_AUTO_EXTRAS, afl->a_extras_cnt); ++i) {
 
     u8 *fn =
-        alloc_printf("%s/queue/.state/auto_extras/auto_%06u", afl->out_dir, i);
+        alloc_printf("%s/queue/.state/auto_extras/auto_%06u%s%s", afl->out_dir, i,
+                     afl->file_extension ? "." : "",
+                     afl->file_extension ? (const char*)afl->file_extension : "");
+
     s32 fd;
 
     fd = open(fn, O_WRONLY | O_CREAT | O_TRUNC, DEFAULT_PERMISSION);