From 76e815e7e530370abf59d5863886b37bc6ebaa16 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 21 Nov 2014 11:07:55 +0100 Subject: Fix off-by-one in fz_write_buffer_byte. --- source/fitz/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/fitz/buffer.c b/source/fitz/buffer.c index 4a87b4ca..c4017392 100644 --- a/source/fitz/buffer.c +++ b/source/fitz/buffer.c @@ -135,7 +135,7 @@ void fz_write_buffer(fz_context *ctx, fz_buffer *buf, const void *data, int len) void fz_write_buffer_byte(fz_context *ctx, fz_buffer *buf, int val) { - if (buf->len > buf->cap) + if (buf->len + 1 > buf->cap) fz_grow_buffer(ctx, buf); buf->data[buf->len++] = val; buf->unused_bits = 0; -- cgit v1.2.3