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

make extendable sbufs as overflowed.

Approved by:	des
This commit is contained in:
phk 2002-01-22 11:22:55 +00:00
parent 069b88ab0a
commit cbd45b6c66

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,