use safe functions

changed strncpy to strncpy_s