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.
This commit is contained in:
Sean McBride
2024-02-22 10:47:53 -05:00
parent 340d6aa97c
commit b2b887d04d
4 changed files with 50 additions and 23 deletions

View File

@ -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);