summaryrefslogtreecommitdiff
path: root/src/thumbnail.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@chaosdorf.de>2017-04-02 15:03:12 +0200
committerGitHub <noreply@github.com>2017-04-02 15:03:12 +0200
commitb6bc4ef76aa1d06ba4af913dc9a112d5b14c4bba (patch)
treed4d29c4544b283e0d2bec3fcaaefd6a25cf2e3e5 /src/thumbnail.c
parent78a840ed30c454d5cfa2acb482fb31e08a637ce6 (diff)
parent575b9345c87f22349c948fcc814c301816315a71 (diff)
Merge pull request #288 from stoeckmann/strncpy
Always terminate strncpy results with '\0'.
Diffstat (limited to 'src/thumbnail.c')
-rw-r--r--src/thumbnail.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/thumbnail.c b/src/thumbnail.c
index c9cc24f..43168c4 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -381,8 +381,10 @@ void init_thumbnail_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(td.im_main, output_buf, &err);
if (err) {
feh_imlib_print_load_error(output_buf, td.im_main, err);