kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 802a78c0b0f53dcaac1604564033682b967aace8
parent d7fbce37f5c31bb93db3836303dc957175b05c37
Author: Joris Vink <joris@coders.se>
Date:   Sat, 21 Nov 2020 13:01:42 +0100

Make sure we check if consume whitespace failed.

Diffstat:
src/json.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/json.c b/src/json.c @@ -83,7 +83,10 @@ kore_json_parse(struct kore_json *json) if (json->root) return (KORE_RESULT_OK); - json_consume_whitespace(json); + if (json_consume_whitespace(json) == -1) { + json->error = KORE_JSON_ERR_INVALID_JSON; + return (KORE_RESULT_ERROR); + } if (!json_peek(json, &ch)) return (KORE_RESULT_ERROR); @@ -102,7 +105,7 @@ kore_json_parse(struct kore_json *json) } /* Don't allow garbage at the end. */ - json_consume_whitespace(json); + (void)json_consume_whitespace(json); if (json->offset != json->length) { json->error = KORE_JSON_ERR_INVALID_JSON; return (KORE_RESULT_ERROR);