Modified x_str_concat to account for the null terminator

This commit is contained in:
xavi 2024-09-22 15:59:22 -07:00
parent 4fb48e6912
commit d4f45c5e48

View File

@ -64,7 +64,7 @@ char* x_strconcat(char* str1, char* str2){
int len1 = x_strlen(str1); int len1 = x_strlen(str1);
int len2 = x_strlen(str2); int len2 = x_strlen(str2);
int new_length = len1 + len2; int new_length = len1 + len2 + 1;
new_string = malloc( sizeof(*new_string) * new_length ); new_string = malloc( sizeof(*new_string) * new_length );
x_strcpy(new_string, str1, new_length); x_strcpy(new_string, str1, new_length);