diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-03-28 14:41:21 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-03-28 14:41:21 -0400 |
| commit | 0519a71688b6bc026847d5ed47274d1fcc5c391b (patch) | |
| tree | 69a3db2baea8800a532149711ab931465c15d9ec /src/stdlib | |
| parent | 84cb29f81925bb7b0dd085a1b672065a008cc2cd (diff) | |
strcpy() -> strlcpy()
Diffstat (limited to 'src/stdlib')
| -rw-r--r-- | src/stdlib/paths.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stdlib/paths.c b/src/stdlib/paths.c index ec07f2d0..7f881c00 100644 --- a/src/stdlib/paths.c +++ b/src/stdlib/paths.c @@ -528,7 +528,7 @@ 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] = {}; - strcpy(buf, path_str); + strlcpy(buf, path_str, sizeof(buf)); if (buf[len-1] == '/') buf[--len] = '\0'; char *created = mkdtemp(buf); @@ -543,7 +543,7 @@ public Path_t Path$write_unique_bytes(Path_t path, Array_t bytes) size_t len = strlen(path_str); if (len >= PATH_MAX) fail("Path is too long: ", path_str); char buf[PATH_MAX] = {}; - strcpy(buf, path_str); + strlcpy(buf, path_str, sizeof(buf)); // Count the number of trailing characters leading up to the last "X" // (e.g. "foo_XXXXXX.tmp" would yield suffixlen = 4) |
