summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2021-04-27 18:43:22 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-04-27 18:44:17 +0200
commitf5de3da2f8882bc8477ebbed106ed3f70f54544a (patch)
tree65f66be310926b5bdd11371dac20de30fb43fbca
parent1f632b841d9b1b5f6274c0e06232172890247fed (diff)
Don't use strncat() with length derived from source stringHEADmaster
This fixes Wstringop-overflow and Wstringop-truncation GCC warnings. See https://gcc.gnu.org/bugzilla//show_bug.cgi?id=88059
-rw-r--r--lib.c4
-rw-r--r--stow.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/lib.c b/lib.c
index 01cdbd0..717979b 100644
--- a/lib.c
+++ b/lib.c
@@ -151,8 +151,8 @@ make_filepath (char *path, char *filename)
if (filepath == NULL)
return NULL;
- strncpy (filepath, path, length);
- strncat (filepath, filename, strlen (filename));
+ strcpy (filepath, path);
+ strcat (filepath, filename);
return filepath;
}
diff --git a/stow.c b/stow.c
index ddbcf20..adfcf53 100644
--- a/stow.c
+++ b/stow.c
@@ -287,7 +287,7 @@ stow_diradd (char *dir, int flags, struct patternlist *patternlist,
if (tmp == NULL)
return ENOMEM;
- strncpy (tmp, dir, dir_len);
+ strcpy (tmp, dir);
tmp[dir_len] = '/';
tmp[dir_len + 1] = 0;