json: add spa_json_parse_stringn()

It also checks the destination size.
This commit is contained in:
Wim Taymans 2022-01-04 12:35:09 +01:00
parent c46113faa3
commit 611591d0fc
9 changed files with 30 additions and 20 deletions

View file

@ -1632,7 +1632,7 @@ static int json_to_pod(struct spa_pod_builder *b, uint32_t id,
}
else {
char *val = alloca(len+1);
spa_json_parse_string(value, len, val);
spa_json_parse_stringn(value, len, val, len+1);
switch (info ? info->parent : SPA_TYPE_Struct) {
case SPA_TYPE_Id:
if ((ti = find_type_info(info->values, val)) != NULL)