From 0ed86941ce51bcd6c2dc9a5e9a84706dc2dff145 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 2 Mar 2020 12:26:10 +0100 Subject: [PATCH] client-node: only return -ENOENT for unknown param Always iterate all params because we are only supposed to return -ENOENT for unknown params and if we start iterating at some random start position we might be past the paran and report -ENOENT wrongly. --- src/modules/module-client-node/client-node.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/module-client-node/client-node.c b/src/modules/module-client-node/client-node.c index 74b1491bb..8faadb14e 100644 --- a/src/modules/module-client-node/client-node.c +++ b/src/modules/module-client-node/client-node.c @@ -286,7 +286,7 @@ static int impl_node_enum_params(void *object, int seq, spa_return_val_if_fail(num != 0, -EINVAL); result.id = id; - result.next = start; + result.next = 0; while (true) { struct spa_pod *param; @@ -301,6 +301,10 @@ static int impl_node_enum_params(void *object, int seq, continue; found = true; + + if (result.index < start) + continue; + spa_pod_builder_init(&b, buffer, sizeof(buffer)); if (spa_pod_filter(&b, &result.param, param, filter) != 0) continue; @@ -572,7 +576,7 @@ impl_node_port_enum_params(void *object, int seq, this, seq, direction, port_id, id, start, num, port->n_params); result.id = id; - result.next = start; + result.next = 0; while (true) { struct spa_pod *param; @@ -587,6 +591,10 @@ impl_node_port_enum_params(void *object, int seq, continue; found = true; + + if (result.index < start) + continue; + spa_pod_builder_init(&b, buffer, sizeof(buffer)); if (spa_pod_filter(&b, &result.param, param, filter) < 0) continue;