mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05: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
|
|
@ -165,7 +165,7 @@ static int do_extension_stream_restore_read(struct client *client, uint32_t comm
|
|||
if (spa_json_enter_object(&it[0], &it[1]) <= 0)
|
||||
continue;
|
||||
|
||||
while (spa_json_get_string(&it[1], key, sizeof(key)-1) > 0) {
|
||||
while (spa_json_get_string(&it[1], key, sizeof(key)) > 0) {
|
||||
if (spa_streq(key, "volume")) {
|
||||
if (spa_json_get_float(&it[1], &volume) <= 0)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ static int bluez_card_object_message_handler(struct pw_manager *m, struct pw_man
|
|||
return -EINVAL;
|
||||
|
||||
spa_json_init(&it, params, strlen(params));
|
||||
if (spa_json_get_string(&it, codec, sizeof(codec)-1) <= 0)
|
||||
if (spa_json_get_string(&it, codec, sizeof(codec)) <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
codec_id = atoi(codec);
|
||||
|
|
|
|||
|
|
@ -771,7 +771,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;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ static int match(const char *rules, struct spa_dict *dict, uint64_t *quirks)
|
|||
int match = true;
|
||||
uint64_t quirks_cur = 0;
|
||||
|
||||
while (spa_json_get_string(&it[0], key, sizeof(key)-1) > 0) {
|
||||
while (spa_json_get_string(&it[0], key, sizeof(key)) > 0) {
|
||||
char val[4096];
|
||||
const char *str, *value;
|
||||
int len;
|
||||
|
|
@ -83,7 +83,7 @@ static int match(const char *rules, struct spa_dict *dict, uint64_t *quirks)
|
|||
|
||||
if (spa_streq(key, "quirks")) {
|
||||
if (spa_json_enter_array(&it[0], &it[1]) > 0) {
|
||||
while (spa_json_get_string(&it[1], val, sizeof(val)-1) > 0)
|
||||
while (spa_json_get_string(&it[1], val, sizeof(val)) > 0)
|
||||
quirks_cur |= parse_quirks(val);
|
||||
}
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -942,7 +942,7 @@ int servers_create_and_start(struct impl *impl, const char *addresses, struct pw
|
|||
if (spa_json_enter_array(&it[0], &it[1]) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
while (spa_json_get_string(&it[1], addr_str, sizeof(addr_str) - 1) > 0) {
|
||||
while (spa_json_get_string(&it[1], addr_str, sizeof(addr_str)) > 0) {
|
||||
res = parse_address(addr_str, &addrs);
|
||||
if (res < 0) {
|
||||
pw_log_warn("pulse-server %p: failed to parse address '%s': %s",
|
||||
|
|
|
|||
|
|
@ -787,7 +787,7 @@ static int parse_params(struct impl *impl)
|
|||
|
||||
spa_json_init(&it[0], str, strlen(str));
|
||||
if (spa_json_enter_array(&it[0], &it[1]) > 0) {
|
||||
while (spa_json_get_string(&it[1], value, sizeof(value)-1) > 0) {
|
||||
while (spa_json_get_string(&it[1], value, sizeof(value)) > 0) {
|
||||
if (create_server(impl, value) == NULL) {
|
||||
pw_log_warn("%p: can't create server for %s: %m",
|
||||
impl, value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue