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

@ -130,7 +130,8 @@ static int do_match(const char *rules, struct spa_dict *dict, uint32_t *no_featu
if (spa_json_is_null(value, len)) {
value = NULL;
} else {
spa_json_parse_string(value, SPA_MIN(len, (int)sizeof(val)-1), val);
if (spa_json_parse_stringn(value, len, val, sizeof(val)) < 0)
continue;
value = val;
}