[asterisk-bugs] [JIRA] (ASTERISK-28459) Asterisk is dropping part of a string passed to functions

Asterisk Team (JIRA) noreply at issues.asterisk.org
Mon Jun 24 05:06:47 CDT 2019


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=247457#comment-247457 ] 

Asterisk Team commented on ASTERISK-28459:
------------------------------------------

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

> Asterisk is dropping part of a string passed to functions
> ---------------------------------------------------------
>
>                 Key: ASTERISK-28459
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28459
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Functions/General
>    Affects Versions: 16.4.0
>         Environment: CentOS Linux release 7.6 with Asterisk 16.4.0
>            Reporter: Jan Blom
>
> We need to pass around variables containing special characters, i.e. non-alfanumeric chars. This typically include SIP Call-Id from some vendors.
> We have so far managed to deal with all situations using quotes and escape character in accordance with https://wiki.asterisk.org/wiki/display/AST/Parameter+Quoting.
> However when having a string containing a closing parenthesis _and_ a colon, the string gets cut-off when passing it to a function. This becomes a big issue for us since this affects ODBC database calls as well as for example SQL_ESC() function. 
> Calling this dialplan results in the output below:
> {code}
> [test]
> exten => main,1,NoOp
>  same => n,Set(LOCAL(input)=1234ab)cd:efg)
>  same => n,Verbose(0,--- Test 1 ---)
>  same => n,Verbose(0,Input:    ${input})
>  same => n,Gosub(sub,1(${input}))
>  same => n,Set(LOCAL(output)=${GOSUB_RETVAL})
>  same => n,Verbose(0,Output:   ${output})
>  same => n,Verbose(0,Function: ${PASSTHRU(${input})})
>  same => n,Verbose(0,--- Test 2 ---)
>  same => n,Verbose(0,Input:    ${input})
>  same => n,Gosub(sub,1("${input}"))
>  same => n,Set(LOCAL(output)=${GOSUB_RETVAL})
>  same => n,Verbose(0,Output:   ${output})
>  same => n,Verbose(0,Function: ${PASSTHRU("${input}")})
>  same => n,Verbose(0,--- Test done ---)
>  same => n,Return
> exten => sub,1,NoOp
>  same => n,Verbose(0,In sub:   ${ARG1})
>  same => n,Return(${ARG1})
> {code}
> Result:
> {noformat}
> --- Test 1 ---
> Input:    1234ab)cd:efg
> In sub:   1234ab)cd:efg
> Output:   1234ab)cd:efg
> Function: 1234ab
> --- Test 2 ---
> Input:    1234ab)cd:efg
> In sub:   "1234ab)cd:efg"
> Output:   "1234ab)cd:efg"
> Function: "1234ab
> --- Test done ---
> {noformat}
> You can see the cut-off string returned from PASSTHRU(). We could use any function that takes a string as input and have the same result. The test shows that calling subroutines with Gosub works fine though. 
> It doesn't matter if we surround the string in quotes (the difference between Test 1 ans Test 2) or if we escape the parenthesis and/or colon in any combination with a backslash. We always get the corrupted string passed into the function. 
> We haven't been to find any workaround to this problem. It breaks our database calling, using ODBC. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list