mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
treewide: check for JSON parse errors
Check for JSON parse errors, and log error messages as appropriate. It's mostly enough to do this where the input is parsed for the first time, e.g. via pw_properties_new_string, as that already validates the JSON syntax.
This commit is contained in:
parent
7ee8df39e8
commit
0da9255057
3 changed files with 24 additions and 2 deletions
|
|
@ -159,6 +159,7 @@ static void load_quirks(struct spa_bt_quirks *this, const char *str, size_t len)
|
|||
struct spa_json data = SPA_JSON_INIT(str, len);
|
||||
struct spa_json rules;
|
||||
char key[1024];
|
||||
int line, col;
|
||||
|
||||
if (spa_json_enter_object(&data, &rules) <= 0)
|
||||
spa_json_init(&rules, str, len);
|
||||
|
|
@ -182,6 +183,9 @@ static void load_quirks(struct spa_bt_quirks *this, const char *str, size_t len)
|
|||
else if (spa_streq(key, "bluez5.features.device") && !this->device_rules)
|
||||
this->device_rules = strndup(value, sz);
|
||||
}
|
||||
|
||||
if (spa_json_get_error(&rules, str, &line, &col))
|
||||
spa_log_error(this->log, "spa.bluez5 quirks syntax error, line:%d col:%d", line, col);
|
||||
}
|
||||
|
||||
static int load_conf(struct spa_bt_quirks *this, const char *path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue