In certain cases sbuf_printf() and sbuf_vprintf() could mistakely

make extendable sbufs as overflowed.

Approved by:	des
This commit is contained in:
Poul-Henning Kamp 2002-01-22 11:22:55 +00:00
parent 7109d65231
commit 1a25c86b3b

View File

@ -426,7 +426,7 @@ sbuf_vprintf(struct sbuf *s, const char *fmt, va_list ap)
* given sufficient space, hence the min() calculation below.
*/
s->s_len += min(len, SBUF_FREESPACE(s));
if (!SBUF_HASROOM(s))
if (!SBUF_HASROOM(s) && !SBUF_CANEXTEND(s))
SBUF_SETFLAG(s, SBUF_OVERFLOWED);
KASSERT(s->s_len < s->s_size,