summaryrefslogtreecommitdiff
path: root/src/index.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/index.c b/src/index.c
index a71744d..7a2f5fc 100644
--- a/src/index.c
+++ b/src/index.c
@@ -324,8 +324,10 @@ void init_index_mode(void)
if (opt.output_dir)
snprintf(output_buf, 1024, "%s/%s", opt.output_dir, opt.output_file);
- else
- strncpy(output_buf, opt.output_file, 1024);
+ else {
+ strncpy(output_buf, opt.output_file, 1023);
+ output_buf[1023] = '\0';
+ }
gib_imlib_save_image_with_error_return(im_main, output_buf, &err);
if (err) {