From 0bfc02581f457b7841bc52009a0bf811a66b5491 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 25 Aug 2023 11:08:18 +0200 Subject: [PATCH] conf: handle regcomp errors and warn Instead of silently ignoring the problem. See #3460 --- src/pipewire/conf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pipewire/conf.c b/src/pipewire/conf.c index b74f70e37..91ef7c049 100644 --- a/src/pipewire/conf.c +++ b/src/pipewire/conf.c @@ -619,7 +619,12 @@ static bool find_match(struct spa_json *arr, const struct spa_dict *props) if (str != NULL) { if (value[0] == '~') { regex_t preg; - if (regcomp(&preg, value+1, REG_EXTENDED | REG_NOSUB) == 0) { + int res; + if ((res = regcomp(&preg, value+1, REG_EXTENDED | REG_NOSUB)) != 0) { + char errbuf[1024]; + regerror(res, &preg, errbuf, sizeof(errbuf)); + pw_log_warn("invalid regex %s: %s", value+1, errbuf); + } else { if (regexec(&preg, str, 0, NULL, 0) == 0) success = true; regfree(&preg);