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

This commit is contained in:
Nicolas Badoux
2024-08-30 13:36:22 +02:00
committed by Alan Wang
parent 078c4e6c53
commit 9d1b229086
3 changed files with 35 additions and 1 deletions
+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);