From 45b79be2f6cf1e23f0e50747934390c01625af8b Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Wed, 12 Jan 2022 19:16:57 +0100 Subject: [PATCH] fix json_reader_literal --- application/json.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application/json.c b/application/json.c index 719a570..5a5446e 100644 --- a/application/json.c +++ b/application/json.c @@ -614,9 +614,10 @@ int json_reader_isnull(JSONParser *p) { JSONLiteralType json_reader_literal(JSONParser *p) { const char *l = p->reader_token.content; - if(!strcmp(l, "true")) { + size_t token_len = p->reader_token.length; + if(token_len == 4 && !memcpy(l, "true", 5)) { return JSON_TRUE; - } else if(!strcmp(l, "false")) { + } else if(token_len == 5 && !memcpy(l, "false", 5)) { return JSON_FALSE; } return JSON_NULL; -- 1.8.3.1