Commit 2f15cfb8 authored by Jussi Kivilinna's avatar Jussi Kivilinna Committed by Pekka Niemimaa
Browse files

netutils/cJSON: allow old parsing behavior to be configured; to ignore missing...


netutils/cJSON: allow old parsing behavior to be configured; to ignore missing null-terminator on input
Signed-off-by: default avatarJussi Kivilinna <jussi.kivilinna@haltian.com>
parent 2265a8bd
......@@ -15,4 +15,11 @@ config NETUTILS_JSON
adapted for NuttX by Darcy Gong.
if NETUTILS_JSON
config NETUTILS_JSON_PARSE_IGNORE_MISSING_NULL_TERMINATOR
bool "Ignore missing NULL terminator"
default n
---help---
Allow cJSON parser to ignore missing NULL terminator after
parsed object. This is the old behavior for cJSON, not matching JSON
spec.
endif
......@@ -876,6 +876,7 @@ cJSON *cJSON_Parse_Stream(char (*getc_fn)(void *priv), void *priv)
return NULL;
}
#ifndef CONFIG_NETUTILS_JSON_PARSE_IGNORE_MISSING_NULL_TERMINATOR
skip(&stream);
if (stream_get(&stream))
{
......@@ -884,6 +885,7 @@ cJSON *cJSON_Parse_Stream(char (*getc_fn)(void *priv), void *priv)
cJSON_Delete(c);
return NULL;
}
#endif
return c;
}
......
......@@ -1467,6 +1467,7 @@ CONFIG_NETUTILS_DNSCLIENT_RETRIES=3
# CONFIG_NETUTILS_FTPC is not set
# CONFIG_NETUTILS_FTPD is not set
CONFIG_NETUTILS_JSON=y
CONFIG_NETUTILS_JSON_PARSE_IGNORE_MISSING_NULL_TERMINATOR=y
CONFIG_NETUTILS_NETLIB=y
CONFIG_NETUTILS_NTPCLIENT=y
CONFIG_NETUTILS_NTPCLIENT_POLLDELAYSEC=60
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment