[Asterisk-code-review] core_local: Fix local channel parsing with slashes (asterisk[master])

N A asteriskteam at digium.com
Tue Apr 12 06:57:28 CDT 2022


Attention is currently required from: Joshua Colp, Richard Mudgett.
N A has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/18369 )

Change subject: core_local: Fix local channel parsing with slashes
......................................................................


Patch Set 3:

(2 comments)

File main/core_local.c:

https://gerrit.asterisk.org/c/asterisk/+/18369/comment/05a9f50f_35571cf7 
PS3, Line 317: 		if (*ptr != '/' && *ptr != 'n' && *ptr != 'j' && *ptr != 'm' && *ptr != 'b') {
> This feels brittle.
It's admittedly somewhat of a hack, but I couldn't think of a better way to deduce whether or not it's options or something else. The chance of this returning a false positive/negative is basically zero.


https://gerrit.asterisk.org/c/asterisk/+/18369/comment/dffcceb3_45c716c7 
PS3, Line 907: 	if ((opts = strrchr(parse, '/')) && really_local_options(opts)) {
> What are the various formats you are supporting here (with any without options), so it can be seen i […]
Doing something like this is quite common:

Originate(Local/PJSIP/Something,exten,something,s,1,,a)

Admittedly I never have the '/' in a hardcoded static extension. I only have pattern match extensions such as
exten => _[A-Z]. which capture any valid TECH/device without issues.


The other option that comes to mind is seeing if an extension begins with a valid channel tech. But I don't like that idea as it limits the fix to just device names, and anybody could reasonably use a slash in their extension for any reason desired.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18369
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I8e85bc14072e452d0537a801aba17779569d0360
Gerrit-Change-Number: 18369
Gerrit-PatchSet: 3
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Attention: Joshua Colp <jcolp at sangoma.com>
Gerrit-Attention: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Tue, 12 Apr 2022 11:57:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220412/8c006ecb/attachment.html>


More information about the asterisk-code-review mailing list