removed vla for tmpfile

This commit is contained in:
Dominik Maier
2020-04-10 20:35:16 +02:00
parent f0f83bab52
commit 3209a9d4e8

View File

@ -919,21 +919,20 @@ int main(int argc, char **argv_orig, char **envp) {
if ((afl->tmp_dir = afl->afl_env.afl_tmpdir) != NULL && if ((afl->tmp_dir = afl->afl_env.afl_tmpdir) != NULL &&
!afl->in_place_resume) { !afl->in_place_resume) {
char tmpfile[afl->file_extension ? strlen(afl->tmp_dir) + 1 + 10 + 1 + char tmpfile[PATH_MAX];
strlen(afl->file_extension) + 1
: strlen(afl->tmp_dir) + 1 + 10 + 1];
if (afl->file_extension) { if (afl->file_extension) {
sprintf(tmpfile, "%s/.cur_input.%s", afl->tmp_dir, afl->file_extension); snprintf(tmpfile, PATH_MAX, "%s/.cur_input.%s", afl->tmp_dir, afl->file_extension);
} else { } else {
sprintf(tmpfile, "%s/.cur_input", afl->tmp_dir); snprintf(tmpfile, PATH_MAX, "%s/.cur_input", afl->tmp_dir);
} }
if (access(tmpfile, F_OK) != /* there is still a race condition here, but well ... */
-1) // there is still a race condition here, but well ... if (access(tmpfile, F_OK) != -1)
FATAL( FATAL(
"AFL_TMPDIR already has an existing temporary input file: %s - if " "AFL_TMPDIR already has an existing temporary input file: %s - if "
"this is not from another instance, then just remove the file.", "this is not from another instance, then just remove the file.",