Fix off-by-one error when reallocing buffer

There was an invalid boundary check when appending to a buffer. The
consequence of this was that the POST data buffer was deterministically
realloced.
This commit is contained in:
Carl Ekerot 2016-01-09 01:57:59 +01:00
parent e580e6678e
commit 53e8220ff6
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ kore_buf_create(u_int32_t initial)
void
kore_buf_append(struct kore_buf *buf, const void *d, u_int32_t len)
{
if ((buf->offset + len) >= buf->length) {
if ((buf->offset + len) > buf->length) {
buf->length += len + KORE_BUF_INCREMENT;
buf->data = kore_realloc(buf->data, buf->length);
}