mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
json: spa_json_get_string() writes up to len chars or fail
This commit is contained in:
parent
68b31d37d9
commit
c46113faa3
17 changed files with 26 additions and 26 deletions
|
|
@ -46,7 +46,7 @@ static bool find_match(struct spa_json *arr, const struct spa_dict *props)
|
|||
int match = 0, fail = 0;
|
||||
int len;
|
||||
|
||||
while (spa_json_get_string(&it[0], key, sizeof(key)-1) > 0) {
|
||||
while (spa_json_get_string(&it[0], key, sizeof(key)) > 0) {
|
||||
bool success = false;
|
||||
|
||||
if ((len = spa_json_next(&it[0], &value)) <= 0)
|
||||
|
|
@ -103,7 +103,7 @@ int pw_jack_match_rules(const char *rules, size_t size, const struct spa_dict *p
|
|||
char key[64];
|
||||
bool have_match = false, have_actions = false;
|
||||
|
||||
while (spa_json_get_string(&it[2], key, sizeof(key)-1) > 0) {
|
||||
while (spa_json_get_string(&it[2], key, sizeof(key)) > 0) {
|
||||
if (spa_streq(key, "matches")) {
|
||||
if (spa_json_enter_array(&it[2], &it[3]) < 0)
|
||||
break;
|
||||
|
|
@ -120,7 +120,7 @@ int pw_jack_match_rules(const char *rules, size_t size, const struct spa_dict *p
|
|||
if (!have_match || !have_actions)
|
||||
continue;
|
||||
|
||||
while (spa_json_get_string(&actions, key, sizeof(key)-1) > 0) {
|
||||
while (spa_json_get_string(&actions, key, sizeof(key)) > 0) {
|
||||
int res, len;
|
||||
pw_log_debug("action %s", key);
|
||||
|
||||
|
|
|
|||
|
|
@ -2489,7 +2489,7 @@ static int json_object_find(const char *obj, const char *key, char *value, size_
|
|||
if (spa_json_enter_object(&it[0], &it[1]) <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
while (spa_json_get_string(&it[1], k, sizeof(k)-1) > 0) {
|
||||
while (spa_json_get_string(&it[1], k, sizeof(k)) > 0) {
|
||||
if (spa_streq(k, key)) {
|
||||
if (spa_json_get_string(&it[1], value, len) <= 0)
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue