sprintf to snprintf