[asterisk-bugs] [Asterisk 0013195]: chan_sip fails to parse reason parameter in Diversion: header

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Jul 30 15:15:00 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13195 
====================================================================== 
Reported By:                woodsfsg
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   13195
Category:                   Channels/chan_sip/General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 134222 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-07-30 04:29 CDT
Last Modified:              2008-07-30 15:15 CDT
====================================================================== 
Summary:                    chan_sip fails to parse reason parameter in
Diversion: header
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.
====================================================================== 

---------------------------------------------------------------------- 
 (0090864) putnopvut (administrator) - 2008-07-30 15:15
 http://bugs.digium.com/view.php?id=13195#c90864 
---------------------------------------------------------------------- 
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. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-07-30 15:15 putnopvut      Note Added: 0090864                          
======================================================================




More information about the asterisk-bugs mailing list