diff options
author | Olof-Joachim Frahm <olof@shiftleft.io> | 2020-05-29 11:41:58 +0200 |
---|---|---|
committer | Olof-Joachim Frahm <olof@shiftleft.io> | 2020-05-29 11:41:58 +0200 |
commit | a23571495beb95e146755e16b1a02dff03624625 (patch) | |
tree | e373c1e1e68539407a076003f8b92254941cce17 /src/filelist.c | |
parent | c9e024daeb43094696a05c8d03ef6682ed683dae (diff) |
Fix some warnings from `gcc`.
Diffstat (limited to 'src/filelist.c')
-rw-r--r-- | src/filelist.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/filelist.c b/src/filelist.c index 4939d4d..d5b0750 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -398,7 +398,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 { |