mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-12 13:30:15 -05:00
conf: handle regcomp errors and warn
Instead of silently ignoring the problem. See #3460
This commit is contained in:
parent
c41c812325
commit
0bfc02581f
1 changed files with 6 additions and 1 deletions
|
|
@ -619,7 +619,12 @@ static bool find_match(struct spa_json *arr, const struct spa_dict *props)
|
||||||
if (str != NULL) {
|
if (str != NULL) {
|
||||||
if (value[0] == '~') {
|
if (value[0] == '~') {
|
||||||
regex_t preg;
|
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)
|
if (regexec(&preg, str, 0, NULL, 0) == 0)
|
||||||
success = true;
|
success = true;
|
||||||
regfree(&preg);
|
regfree(&preg);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue