valgrind: strncpy src and dst must not overlap; better solution needed