From cc84a446be20cc283bafdc4d94c050ba1111ac02 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Thu, 23 Mar 2017 21:27:54 +0100 Subject: [PATCH] ensure: Fix potential off by one error. --- cJSON.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index 283faa0..8c0e932 100644 --- a/cJSON.c +++ b/cJSON.c @@ -259,7 +259,7 @@ static unsigned char* ensure(printbuffer * const p, size_t needed, const interna return NULL; } - needed += p->offset; + needed += p->offset + 1; if (needed <= p->length) { return p->buffer + p->offset;