BUG/MEDIUM: buffers: Make sure we don't wrap in ci_insert_line2/b_rep_blk.

In ci_insert_line2() and b_rep_blk(), we can't afford to wrap, so don't use
b_tail() to check if we do, use __b_tail() instead.

This should be backported to previous versions.
This commit is contained in:
Olivier Houchard 2018-09-26 15:09:58 +02:00 committed by Christopher Faulet
parent 747ca61693
commit 363c745569
2 changed files with 2 additions and 2 deletions

View File

@ -578,7 +578,7 @@ static inline int b_rep_blk(struct buffer *b, char *pos, char *end, const char *
delta = len - (end - pos);
if (b_tail(b) + delta > b_wrap(b))
if (__b_tail(b) + delta > b_wrap(b))
return 0; /* no space left */
if (b_data(b) &&

View File

@ -417,7 +417,7 @@ int ci_insert_line2(struct channel *c, int pos, const char *str, int len)
delta = len + 2;
if (b_tail(b) + delta >= b_wrap(b))
if (__b_tail(b) + delta >= b_wrap(b))
return 0; /* no space left */
if (b_data(b) &&