코드의 문제에 관해서라면.. strcpy() man page에 이런 내용이 있습니다 참조해 주세요.
The stpcpy() and strcpy() functions copy the string src to dst (including the terminating `\0' character).
The stpncpy() and strncpy() functions copy at most n characters from src into dst. If src is less than n
characters long, the remainder of dst is filled with `\0' characters. Otherwise, dst is not terminated.
*The source and destination strings should not overlap, as the behavior is undefined.*