summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2021-04-26 22:09:11 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-04-26 22:09:11 +0200
commit1f632b841d9b1b5f6274c0e06232172890247fed (patch)
tree9d28a1609f7ee3b151ccef0252598ff03acedfd9
parent2dfc9328efbd744545586dee18ad0ee2ffa9eb9d (diff)
Fix missing string termination
-rw-r--r--stow.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/stow.c b/stow.c
index 812d33b..ddbcf20 100644
--- a/stow.c
+++ b/stow.c
@@ -282,7 +282,7 @@ stow_diradd (char *dir, int flags, struct patternlist *patternlist,
{
char *tmp;
- tmp = (char *) malloc (dir_len + 1);
+ tmp = (char *) malloc (dir_len + 2);
if (tmp == NULL)
return ENOMEM;
@@ -290,6 +290,7 @@ stow_diradd (char *dir, int flags, struct patternlist *patternlist,
strncpy (tmp, dir, dir_len);
tmp[dir_len] = '/';
+ tmp[dir_len + 1] = 0;
dir = tmp;
}