about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-04-10 20:35:16 +0200
committerDominik Maier <domenukk@gmail.com>2020-04-10 20:35:16 +0200
commit3209a9d4e88f09790e073af7fa90914a25e150c4 (patch)
tree54df82790a27eda37ccbdd3c03feaa821fb3a74b /src
parentf0f83bab5299098a441af40236f3758171b69889 (diff)
downloadafl++-3209a9d4e88f09790e073af7fa90914a25e150c4.tar.gz
removed vla for tmpfile
Diffstat (limited to 'src')
-rw-r--r--src/afl-fuzz.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/afl-fuzz.c b/src/afl-fuzz.c
index b2c96f04..9de80c72 100644
--- a/src/afl-fuzz.c
+++ b/src/afl-fuzz.c
@@ -919,21 +919,20 @@ int main(int argc, char **argv_orig, char **envp) {
   if ((afl->tmp_dir = afl->afl_env.afl_tmpdir) != NULL &&
       !afl->in_place_resume) {
 
-    char tmpfile[afl->file_extension ? strlen(afl->tmp_dir) + 1 + 10 + 1 +
-                                           strlen(afl->file_extension) + 1
-                                     : strlen(afl->tmp_dir) + 1 + 10 + 1];
+    char tmpfile[PATH_MAX];
+
     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 {
 
-      sprintf(tmpfile, "%s/.cur_input", afl->tmp_dir);
+      snprintf(tmpfile, PATH_MAX, "%s/.cur_input", afl->tmp_dir);
 
     }
 
-    if (access(tmpfile, F_OK) !=
-        -1)  // there is still a race condition here, but well ...
+    /* there is still a race condition here, but well ... */
+    if (access(tmpfile, F_OK) != -1)
       FATAL(
           "AFL_TMPDIR already has an existing temporary input file: %s - if "
           "this is not from another instance, then just remove the file.",