mirror of
https://github.com/json-c/json-c.git
synced 2026-03-13 18:19:06 +08:00
Issue #881: don't allow json_tokener_new_ex() with a depth < 1
This commit is contained in:
@@ -154,6 +154,9 @@ struct json_tokener *json_tokener_new_ex(int depth)
|
|||||||
{
|
{
|
||||||
struct json_tokener *tok;
|
struct json_tokener *tok;
|
||||||
|
|
||||||
|
if (depth < 1)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
tok = (struct json_tokener *)calloc(1, sizeof(struct json_tokener));
|
tok = (struct json_tokener *)calloc(1, sizeof(struct json_tokener));
|
||||||
if (!tok)
|
if (!tok)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ JSON_EXPORT struct json_tokener *json_tokener_new(void);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a new json_tokener with a custom max nesting depth.
|
* Allocate a new json_tokener with a custom max nesting depth.
|
||||||
|
* The depth must be at least 1.
|
||||||
* @see JSON_TOKENER_DEFAULT_DEPTH
|
* @see JSON_TOKENER_DEFAULT_DEPTH
|
||||||
*/
|
*/
|
||||||
JSON_EXPORT struct json_tokener *json_tokener_new_ex(int depth);
|
JSON_EXPORT struct json_tokener *json_tokener_new_ex(int depth);
|
||||||
|
|||||||
Reference in New Issue
Block a user