From 68b31d37d9fc08043238699b553ecaa6dc3a5a1f Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 4 Jan 2022 10:15:35 +0100 Subject: [PATCH] json: check spa_json_get_string() return value correctly It is only successful when > 0. --- spa/plugins/bluez5/quirks.c | 2 +- src/pipewire/properties.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spa/plugins/bluez5/quirks.c b/spa/plugins/bluez5/quirks.c index d2262cfa5..531136903 100644 --- a/spa/plugins/bluez5/quirks.c +++ b/spa/plugins/bluez5/quirks.c @@ -183,7 +183,7 @@ static void load_quirks(struct spa_bt_quirks *this, const char *str, size_t len) if (spa_json_enter_object(&data, &rules) <= 0) spa_json_init(&rules, str, len); - while (spa_json_get_string(&rules, key, sizeof(key)-1)) { + while (spa_json_get_string(&rules, key, sizeof(key)-1) > 0) { int sz; const char *value; diff --git a/src/pipewire/properties.c b/src/pipewire/properties.c index e5985c009..f4247cc5f 100644 --- a/src/pipewire/properties.c +++ b/src/pipewire/properties.c @@ -166,7 +166,7 @@ int pw_properties_update_string(struct pw_properties *props, const char *str, si if (spa_json_enter_object(&it[0], &it[1]) <= 0) spa_json_init(&it[1], str, size); - while (spa_json_get_string(&it[1], key, sizeof(key)-1)) { + while (spa_json_get_string(&it[1], key, sizeof(key)-1) > 0) { int len; const char *value;