diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-04-29 13:20:25 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-05-11 15:50:49 -0400 |
| commit | 59f63ed5665aee5596ead0e8c79e883c4cb27bf3 (patch) | |
| tree | 555a974b3cf394067668f3d537563eaa71cd3971 /src | |
| parent | c8812a2d2c8d0ab5e79ddf374e1c2b2235de9810 (diff) | |
| download | stasis-59f63ed5665aee5596ead0e8c79e883c4cb27bf3.tar.gz | |
join: maybe truncate string
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/core/str.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/core/str.c b/src/lib/core/str.c index c80666b..447fc78 100644 --- a/src/lib/core/str.c +++ b/src/lib/core/str.c @@ -175,7 +175,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); } |
