use the safer strncpy and snprintf functions