Fix sprintf and snprintf to always null terminate
This commit is contained in:
parent
10bf52f68f
commit
d005029577
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user