crash caused by improper C string concatenation
Brought to you by:
donpedro2
> There is an error in your UtilConstStrCat() function.
>
> The length of memory malloc()'ed did not include an extra byte for the
> null character. I have included the corrected routine below.
>
>
> void UtilConstStrCat(t_char **str1, t_char *str2)
> {
> t_uint16 len1 = strlen(*str1);
>
> // Allocate new string
> t_char *newString = (t_char*)malloc(len1 + strlen(str2) + 1);
>
> // Copy strings into buffer
> strcpy(newString, *str1);
> strcpy(newString + len1, str2);
>
> // Assign buffer to string 1
> *str1 = newString;
> }
Logged In: YES
user_id=760114
Originator: NO
Thanks for the fix.
Will be included in v0.0.8