From d4f45c5e48620aeabfb99bd0347d32d458177274 Mon Sep 17 00:00:00 2001 From: xavi Date: Sun, 22 Sep 2024 15:59:22 -0700 Subject: [PATCH] Modified x_str_concat to account for the null terminator --- x_string/src/x_string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x_string/src/x_string.c b/x_string/src/x_string.c index 20d1674..39c4e3d 100644 --- a/x_string/src/x_string.c +++ b/x_string/src/x_string.c @@ -64,7 +64,7 @@ char* x_strconcat(char* str1, char* str2){ int len1 = x_strlen(str1); int len2 = x_strlen(str2); - int new_length = len1 + len2; + int new_length = len1 + len2 + 1; new_string = malloc( sizeof(*new_string) * new_length ); x_strcpy(new_string, str1, new_length);