[asterisk-bugs] [JIRA] (ASTERISK-17944) Display names with '\' characters near quotes make Asterisk fail to parse the quotation marks correctly.

Sean Bright (JIRA) noreply at issues.asterisk.org
Wed Dec 13 08:52:08 CST 2017


     [ https://issues.asterisk.org/jira/browse/ASTERISK-17944?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Bright updated ASTERISK-17944:
-----------------------------------

    Labels: chan-sip-message-parsing  (was: )

> Display names with '\' characters near quotes make Asterisk fail to parse the quotation marks correctly.
> --------------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-17944
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-17944
>             Project: Asterisk
>          Issue Type: Bug
>          Components: Channels/chan_sip/General
>            Reporter: Jonathan Rose
>            Severity: Minor
>              Labels: chan-sip-message-parsing
>
> What I am about to describe is a parsing as well as possibly a config reading issue.
> Asterisk box A has a SIP user with a display name of
> "Super Bob\" set via callerid in sip.conf
> Super Bob calls Asterisk Box B, which fails to make a connection due to the following error:
> [May 31 09:44:39] WARNING[12931]: sip/reqresp_parser.c:1023 get_in_brackets_full: No closing quote found in '"Super Bob\" <sip:snowball at 10.24.20.132>;tag=as48569096'
> [May 31 09:44:39] WARNING[12931]: chan_sip.c:14803 get_destination: Not a SIP header ("Super Bob\" <sip:snowball)?
>  tmp = <sip:snowball at 10.24.20.132:5060>
> This will also happen with the display-name:
> "Super Bob\\"
> ****** ADDITIONAL INFORMATION ******
> First, if we are going to read '\' as an escape character in the display name, it would probably be best to reflect that in how we read callerid from sip.conf.  As is, \" is treated as a backslash and a quote and not as an escaped quotation mark, so a sip user can't be defined (at least not without DB, but I don't know much about astdb) with escaped quotes in the display name.  Second, in order to search for a closing set of quotes to go with an opening set of quotes, reqresp_parser.c uses find_closing_quote(...) in chan_sip.c, which is either just the wrong function to use for the job or is just broken, because its way of searching for a closing quote is to search for the nearest quote and to just check if there is a backslash in front of it, which is somewhat irreverent of how escape characters function.  This isn't the correct approach to take for this sort of thing and it isn't simply a matter of going back and looking at the character before that one either.
> "Test string\\" - closing quote will be considered escaped, but shouldn't be.
> Meanwhile if you were to simply try and examine the previous two characters, this would become a problem:
> "Test string\\\"... - in this case, if it read the previous two characters and decided that it wasn't escaped when it really was escaped.
> Of course, thinking of a good way to check if a quotation mark should be escaped for not without going to the trouble of interpreting all the escape characters is its own special puzzle.  It's probably not a necessary one to solve since this isn't an operation that is going to be needing performed frequently on a real-time basis.



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



More information about the asterisk-bugs mailing list