[Home]

Summary:ASTERISK-12483: chan_sip fails to parse reason parameter in Diversion: header
Reporter:Staurt Woodsford (woodsfsg)Labels:
Date Opened:2008-07-30 04:29:12Date Closed:2008-07-30 15:16:39
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Recently, a call to get_in_brackets was introduced into the get_rdnis function. get_in_brackets modifies the tmp string by putting a '/0' character in place of the closing '>'. This breaks the subsequent diversion-reason parsing as it effectively truncates tmp.

Two possible fixes:
start the parse from tmp + strlen(tmp) + 1

Or:
refresh tmp by calling get_header again.
Comments:By: Mark Michelson (mmichelson) 2008-07-30 15:15:00

Ah, you're quite right. Good catch. Just so it doesn't seem like I'm ignoring your two suggestions, I'll tell what it is I'm doing instead.

I'm moving the "params = strchr(tmp, ';')" call to above the call to get_in_brackets(). That way, params is already pointing to the proper place when get_in_brackets() modifies tmp. This avoids the costliness of having to call get_header again, and it also prevents the potential access of incorrect memory if starting the parse at strlen(tmp) + 1.

Thanks for the report.

By: Digium Subversion (svnbot) 2008-07-30 15:16:34

Repository: asterisk
Revision: 134556

U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r134556 | mmichelson | 2008-07-30 15:16:34 -0500 (Wed, 30 Jul 2008) | 7 lines

Fix the parsing of the "reason" parameter in the
Diversion: header.

(closes issue ASTERISK-12483)
Reported by: woodsfsg


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=134556