summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2020-03-12 09:35:08 -0700
committerBjorn Andersson <bjorn.andersson@linaro.org>2020-03-14 22:35:16 -0700
commitafce7e2db18bb7e22a42b8895c26c8a2c811b10d (patch)
treed8bd0d0218abbe553bd4d31710dfd31b52bb0d65
parent1048a84703315baa0c1960c4838ba25f321c459d (diff)
fixup! json: Introduce JSON parser
-rw-r--r--json.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/json.c b/json.c
index 930fea4..e08afa4 100644
--- a/json.c
+++ b/json.c
@@ -81,7 +81,7 @@ static int json_parse_string(struct json_value *value)
return 0;
}
- while ((ch = input()) && ch != '"')
+ while ((ch = input()) && ch != '"' && b - buf < sizeof(buf) - 1)
*b++ = ch;
*b = '\0';
@@ -350,7 +350,7 @@ struct json_value *json_parse_file(const char *file)
ret = json_parse_value(root);
if (ret != 1) {
- free(root);
+ json_free(root);
return NULL;
}