Historically snprintf did not guarantee nul-termination in case of truncation so we have code like:
snprintf(buf, sizeof(buf), "%s", name);
buf[sizeof(buf) - 1] = '\0';
but this explicit nul-termination is no longer necessary.
snprintf(buf, sizeof(buf), "%s", name);
buf[sizeof(buf) - 1] = '\0';
but this explicit nul-termination is no longer necessary.
- relates to
-
JDK-8347707 Standardise the use of os::snprintf and os::snprintf_checked
-
- In Progress
-