Without seeing more details, I'll gues that this is probably because you're using pointer-based strings.
Let's say you have a C structure that has a string member. That member should not be a string, rather it should be a byte array, and you should copy the string into the byte array before sending the packet.