diff options
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 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); } |
