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

@ -94,7 +94,8 @@ static int match(const char *rules, struct spa_dict *dict, uint64_t *quirks)
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;
}
str = spa_dict_lookup(dict, key);