aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/paths.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib/paths.c')
-rw-r--r--src/stdlib/paths.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/stdlib/paths.c b/src/stdlib/paths.c
index cad0e0ff..04c6f7ee 100644
--- a/src/stdlib/paths.c
+++ b/src/stdlib/paths.c
@@ -527,7 +527,8 @@ public Path_t Path$unique_directory(Path_t path)
size_t len = strlen(path_str);
if (len >= PATH_MAX) fail("Path is too long: ", path_str);
char buf[PATH_MAX] = {};
- strlcpy(buf, path_str, sizeof(buf));
+ memcpy(buf, path_str, len);
+ buf[len] = '\0';
if (buf[len-1] == '/')
buf[--len] = '\0';
char *created = mkdtemp(buf);
@@ -542,7 +543,8 @@ public Path_t Path$write_unique_bytes(Path_t path, List_t bytes)
size_t len = strlen(path_str);
if (len >= PATH_MAX) fail("Path is too long: ", path_str);
char buf[PATH_MAX] = {};
- strlcpy(buf, path_str, sizeof(buf));
+ memcpy(buf, path_str, len);
+ buf[len] = '\0';
// Count the number of trailing characters leading up to the last "X"
// (e.g. "foo_XXXXXX.tmp" would yield suffixlen = 4)