about summary refs log tree commit diff homepage
path: root/tools/klee-replay/file-creator.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/klee-replay/file-creator.c')
-rw-r--r--tools/klee-replay/file-creator.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/klee-replay/file-creator.c b/tools/klee-replay/file-creator.c
index f843a1eb..497cf1c3 100644
--- a/tools/klee-replay/file-creator.c
+++ b/tools/klee-replay/file-creator.c
@@ -49,10 +49,15 @@ static void check_file(int index, exe_disk_file_t *dfile);
 static int create_link(const char *fname,
                        exe_disk_file_t *dfile,
                        const char *tmpdir) {
-  char buf[64];
+  char buf[PATH_MAX];
   struct stat64 *s = dfile->stat;
 
-  snprintf(buf, sizeof(buf), "%s.lnk", fname);
+  // make sure that the .lnk suffix is not truncated
+  if (snprintf(buf, sizeof buf, "%s.lnk", fname) >= PATH_MAX) {
+    fputs("create_link: fname is too long for additional .lnk suffix", stderr);
+    return -1;
+  }
+
   s->st_mode = (s->st_mode & ~S_IFMT) | S_IFREG;
   create_file(-1, buf, dfile, tmpdir);