[asterisk-bugs] [Asterisk 0011648]: Extra increment of req->headers in add_header function

noreply at bugs.digium.com noreply at bugs.digium.com
Fri Dec 28 09:13:52 CST 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=11648 
====================================================================== 
Reported By:                makoto
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   11648
Category:                   Channels/chan_sip/General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.16.2 
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             12-28-2007 03:57 CST
Last Modified:              12-28-2007 09:13 CST
====================================================================== 
Summary:                    Extra increment of req->headers in add_header
function
Description: 
In add_header function of chan_sip.c, req->headers is incremented twice.
But I think that one of them is not necessary.

====================================================================== 

---------------------------------------------------------------------- 
 putnopvut - 12-28-07 09:13  
---------------------------------------------------------------------- 
I agree that this double increment is buggy, but I would argue that instead
of sergee's patch, the other increment should be removed. Because there's a
check at the beginning of add_header() to see if req->headers is equal to
SIP_MAX_HEADERS (and if it is, we return -1 and print a warning message),
it means that if we reach the bottom of the function, req->headers will
always be less than SIP_MAX_HEADERS prior to incrementing. Because of this,
I think it's safe to unconditionally increment req->headers.

If my logic is flawed here, let me know. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
12-28-07 09:13  putnopvut      Note Added: 0076096                          
======================================================================




More information about the asterisk-bugs mailing list