From 4d84acf9266e9dc0366a01171d4b0fb1410910a2 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Tue, 9 Jan 2018 21:40:55 +0100 Subject: [PATCH] print_number: fix Off-By-One error Thanks @liuyunbin for reporting this in #230 --- cJSON.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index 9b6ef33..4cfc719 100644 --- a/cJSON.c +++ b/cJSON.c @@ -512,7 +512,7 @@ static cJSON_bool print_number(const cJSON * const item, printbuffer * const out } /* reserve appropriate space in the output */ - output_pointer = ensure(output_buffer, (size_t)length); + output_pointer = ensure(output_buffer, (size_t)length + sizeof("")); if (output_pointer == NULL) { return false; -- GitLab