summaryrefslogtreecommitdiff
path: root/src/filelist.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-02-28 09:59:30 +0100
committerGitHub <noreply@github.com>2021-02-28 09:59:30 +0100
commit32924c21ca08e7203ffb376896a4012bd46f1f93 (patch)
tree2a7079ad7c7bea1c30494ff29eb28ffff94fa14a /src/filelist.c
parent61d17588149df64e54734330103ebe0622a8caa0 (diff)
parenta23571495beb95e146755e16b1a02dff03624625 (diff)
Merge pull request #531 from Ferada/fix-some-warnings
Fix some warnings from `gcc`.
Diffstat (limited to 'src/filelist.c')
-rw-r--r--src/filelist.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/filelist.c b/src/filelist.c
index 9d8b38a..49355c4 100644
--- a/src/filelist.c
+++ b/src/filelist.c
@@ -402,7 +402,7 @@ void feh_file_dirname(char *dst, feh_file * f, int maxlen)
return;
}
- strncpy(dst, f->filename, n);
+ memcpy(dst, f->filename, n);
dst[n] = '\0';
}
@@ -650,7 +650,8 @@ char *feh_absolute_path(char *path)
path you give it is relative. Linux and BSD get this right... */
if (getcwd(cwd, sizeof(cwd)) == NULL)
eprintf("Cannot determine working directory:");
- snprintf(temp, sizeof(temp), "%s/%s", cwd, path);
+ if ((size_t) snprintf(temp, sizeof(temp), "%s/%s", cwd, path) >= sizeof(temp))
+ eprintf("Absolute path for working directory was truncated");
if (realpath(temp, fullpath) != NULL) {
ret = estrdup(fullpath);
} else {