Replaced strncpy()

strncpy() performs badly since it writes additional null bytes
to fill dest and doesn't null terminate.