Add a snprintf_safe() helper function