One problem with C is that string handling is error-prone.
A pointer type that indicates that it points to a null-terminated string could help.
String libraries can be used for safe string handling.
Here is a list of potential candidates and random ideas to look at: