mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 16:21:01 +00:00
func_json: Fix crashes for some types
This commit fixes crashes in JSON_DECODE() for types null, true, false
and real numbers.
In addition it ensures that a path is not deeper than 32 levels.
Also allow root object to be an array.
Add unit tests for above cases.
(cherry picked from commit e6d5b8d8cf
)
This commit is contained in:
committed by
Asterisk Development Team
parent
c47a386cf2
commit
7a1208410a
10
main/json.c
10
main/json.c
@@ -250,6 +250,16 @@ struct ast_json *ast_json_null(void)
|
||||
return (struct ast_json *)json_null();
|
||||
}
|
||||
|
||||
int ast_json_is_array(const struct ast_json *json)
|
||||
{
|
||||
return json_is_array((const json_t *)json);
|
||||
}
|
||||
|
||||
int ast_json_is_object(const struct ast_json *json)
|
||||
{
|
||||
return json_is_object((const json_t *)json);
|
||||
}
|
||||
|
||||
int ast_json_is_true(const struct ast_json *json)
|
||||
{
|
||||
return json_is_true((const json_t *)json);
|
||||
|
Reference in New Issue
Block a user