From: Naveen Albert Date: Thu, 24 Feb 2022 16:55:23 +0000 (+0000) Subject: ami: Improve substring parsing for disabled events. X-Git-Tag: 20.0.0-rc1~167 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbde0186c7393fe680c6d2447b8f7201f0ff815c;p=thirdparty%2Fasterisk.git ami: Improve substring parsing for disabled events. ASTERISK_29853 added the ability to selectively disable AMI events on a global basis, but the logic for this uses strstr which means that events with names which are the prefix of another event, if disabled, could disable those events as well. Instead, we account for this possibility to prevent this undesired behavior from occuring. ASTERISK_29853 Change-Id: Icccd1872602889806740971e4adf932f92466959 --- diff --git a/main/manager.c b/main/manager.c index f6feb8e307..76a6611a24 100644 --- a/main/manager.c +++ b/main/manager.c @@ -7234,7 +7234,7 @@ int __ast_manager_event_multichan(int category, const char *event, int chancount int res; if (!ast_strlen_zero(manager_disabledevents)) { - if (strstr(manager_disabledevents, event)) { + if (ast_in_delimited_string(event, manager_disabledevents, ',')) { ast_debug(3, "AMI Event '%s' is globally disabled, skipping\n", event); /* Event is globally disabled */ ao2_cleanup(sessions);