From a611128a79115fc27e30f9120880c9b9a08fe0c8 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 25 Apr 2021 13:47:23 +0200 Subject: [PATCH] media-session: fix match rule When matching without regex, don't just to a startswith check but also check that the sizes of the strings match. Fixes #1098 --- src/examples/media-session/match-rules.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/examples/media-session/match-rules.c b/src/examples/media-session/match-rules.c index 84dca4146..7e2ab7019 100644 --- a/src/examples/media-session/match-rules.c +++ b/src/examples/media-session/match-rules.c @@ -72,7 +72,8 @@ static bool find_match(struct spa_json *arr, struct pw_properties *props) success = true; regfree(&preg); } - } else if (strncmp(str, value, len) == 0) { + } else if (strncmp(str, value, len) == 0 && + strlen(str) == (size_t)len) { success = true; } }