Fix sprintf and snprintf to always null terminate

This commit is contained in:
Ali Mashtizadeh 2015-01-27 10:33:44 -08:00
parent 10bf52f68f
commit d005029577

View File

@ -268,6 +268,8 @@ int sprintf(char *str, const char *fmt, ...)
ret = kvprintf(fmt, strputc, &state, ap);
va_end(ap);
state.cur[0] = '\0';
return ret;
}
@ -285,6 +287,8 @@ int snprintf(char *str, size_t n, const char *fmt, ...)
ret = kvprintf(fmt, strputc, &state, ap);
va_end(ap);
state.cur[0] = '\0';
return ret;
}