summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/ifdtool/ifdtool.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c
index 0425b1cd49..deef1b1fee 100644
--- a/util/ifdtool/ifdtool.c
+++ b/util/ifdtool/ifdtool.c
@@ -552,7 +552,8 @@ static void write_image(char *filename, char *image, int size)
char new_filename[FILENAME_MAX]; // allow long file names
int new_fd;
- strncpy(new_filename, filename, FILENAME_MAX);
+ // - 5: leave room for ".new\0"
+ strncpy(new_filename, filename, FILENAME_MAX - 5);
strncat(new_filename, ".new", FILENAME_MAX - strlen(filename));
printf("Writing new image to %s\n", new_filename);