mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
Fail the sbuf if vsnprintf(3) fails.
This commit is contained in:
parent
0bc8063012
commit
d58b610faa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=288484
|
@ -623,6 +623,10 @@ sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap)
|
|||
va_copy(ap_copy, ap);
|
||||
len = vsnprintf(&s->s_buf[s->s_len], SBUF_FREESPACE(s) + 1,
|
||||
fmt, ap_copy);
|
||||
if (len < 0) {
|
||||
s->s_error = errno;
|
||||
return (-1);
|
||||
}
|
||||
va_end(ap_copy);
|
||||
|
||||
if (SBUF_FREESPACE(s) >= len)
|
||||
|
|
Loading…
Reference in a new issue