aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2026-04-29 13:20:25 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2026-04-29 13:20:25 -0400
commit525ffee8adc9df289dd6eb4b65f70a2bb75940c3 (patch)
treec78ccc85113a4218696c0a2df1548b03b2bd102b
parentfca452625bf6af7efb1d1870a36a74df86051ec4 (diff)
downloadstasis-525ffee8adc9df289dd6eb4b65f70a2bb75940c3.tar.gz
join: maybe truncate string
-rw-r--r--src/lib/core/str.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/core/str.c b/src/lib/core/str.c
index d66a819..5be3aa4 100644
--- a/src/lib/core/str.c
+++ b/src/lib/core/str.c
@@ -159,7 +159,7 @@ char *join(char **arr, const char *separator) {
result = (char *)calloc(total_bytes, sizeof(char));
for (int i = 0; i < records; i++) {
- strncat(result, arr[i], total_bytes - strlen(result) - 1);
+ strncat(result, arr[i], total_bytes - (result ? strlen(result) - 1 : 0));
if (i < (records - 1)) {
strncat(result, separator, total_bytes - strlen(result) - 1);
}