]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: buffer: one byte miss in buffer free space check
authorThierry FOURNIER <tfournier@exceliance.fr>
Tue, 10 Mar 2015 00:55:01 +0000 (01:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 10 Mar 2015 09:17:54 +0000 (10:17 +0100)
Space is not avalaible only if the end of the data inserted
is strictly greater than the end of buffer. If these two value
are equal, the space is avamaible.

src/buffer.c

index e156991e6ce5a96a8ef5ba71a4e9e79c755a0862..3c7f6ccb4d2b69b4bb9685213aa8b4814432ce8b 100644 (file)
@@ -75,7 +75,7 @@ int buffer_replace2(struct buffer *b, char *pos, char *end, const char *str, int
 
        delta = len - (end - pos);
 
-       if (bi_end(b) + delta >= b->data + b->size)
+       if (bi_end(b) + delta > b->data + b->size)
                return 0;  /* no space left */
 
        if (buffer_not_empty(b) &&