Added max recusrion depth for cJSONDuplicate to prevent stack exhaustion in case of circular reference

This commit is contained in:
Nicolas Badoux authored and Alan Wang committed 2024-09-23 19:08:58 +08:00
1 parent 078c4e6c53
commit 9d1b229086
3 files changed
+35 -1

No files matched your search

+6
View File
@@ -137,6 +137,12 @@ typedef int cJSON_bool;
#define CJSON_NESTING_LIMIT 1000
#endif
/* Limits the length of circular references can be before cJSON rejects to parse them.
* This is to prevent stack overflows. */
#ifndef CJSON_CIRCULAR_LIMIT
#define CJSON_CIRCULAR_LIMIT 10000
#endif
/* returns the version of cJSON as a string */
CJSON_PUBLIC(const char*) cJSON_Version(void);