Limit nesting depth to 1000 and make it configurable.

This commit is contained in:
Max Bruckner
2017-04-27 01:48:40 +02:00
parent 5aa152fa83
commit e0d3a8a265
12 changed files with 54 additions and 23 deletions

View File

@ -123,6 +123,12 @@ then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJ
#endif
#endif
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
* This is to prevent stack overflows. */
#ifndef CJSON_NESTING_LIMIT
#define CJSON_NESTING_LIMIT 1000
#endif
/* returns the version of cJSON as a string */
CJSON_PUBLIC(const char*) cJSON_Version(void);