模拟strcat出现栈堆破坏报错

模拟函数strcat时遇到栈堆破坏的问题
void my_strcat(char* destination, const char* source)

{
while (*destination)
{
destination++;
}
while (*source)
{
*destination = *source;
destination++;
source++;
}
*destination = *source;
}

Run-Time Check Failure #2 - Stack around the variable 'arr1' was corrupted.

遍历到 destination 的尾部后需要开辟空间,已经到数组尾部了再继续赋值自加肯定会出错。

要看你调用这个函数的代码才知道

Run-Time Check Failure #2 - Stack around the variable 'arr1' was corrupted. 这个错误提示,不在上面这段代码里。

主要是你怎么调用的?