[asterisk-bugs] [Asterisk 0012061]: [patch] chan_sip in pedantic mode : error in tag checking

noreply at bugs.digium.com noreply at bugs.digium.com
Mon Feb 25 09:13:41 CST 2008


The following issue has been ASSIGNED. 
====================================================================== 
http://bugs.digium.com/view.php?id=12061 
====================================================================== 
Reported By:                flefoll
Assigned To:                file
====================================================================== 
Project:                    Asterisk
Issue ID:                   12061
Category:                   Channels/chan_sip/General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  1.4  
SVN Revision (number only!): 104037 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             02-25-2008 05:06 CST
Last Modified:              02-25-2008 09:13 CST
====================================================================== 
Summary:                    [patch] chan_sip in pedantic mode : error in tag
checking
Description: 
When chan_sip is in pedantic mode, find_call() checks tags in addition of
Call-IDs.

But there is an error in "found" flag evaluation. The test below is
positive if "tag" pointer is null, when it should be positive if "tag"
STRING is EMPTY :
found = ([...] && (!pedanticsipchecking || !tag ||
ast_strlen_zero(p->theirtag) || !strcmp(p->theirtag, tag)));

Due to initial tag="" declaration and due to gettag() function behaviour,
tag pointer should never be null, but pointed string may be empty ("\0").

I suggest to replace "!tag" with "ast_strlen_zero(tag)".

This will address the situation where an INVITE is CANCEL'ed and response
to CANCEL contains no To Tag. See example in RFC 3665, "Session Initiation
Protocol (SIP) Basic Call Flow Examples", 3.8. "Unsuccessful No Answer".
Also seen in real life.
- With "!tag" condition : find_call fails, thus CANCEL is retransmitted
- With "ast_strlen_zero(tag)" condition : find_call succeeds, thus CANCEL
retransmission is properly stopped.

I propose a patch for branch 1.4 and for trunk.

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

---------------------------------------------------------------------- 
 svnbot - 02-25-08 09:13  
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 104082

U   branches/1.4/channels/chan_sip.c

------------------------------------------------------------------------
r104082 | file | 2008-02-25 09:13:39 -0600 (Mon, 25 Feb 2008) | 6 lines

Due to recent changes tag will no longer be NULL if not present so we have
to use ast_strlen_zero to see if it's actually blank.
(closes issue http://bugs.digium.com/view.php?id=12061)
Reported by: flefoll
Patches:
      chan_sip.c.br14.patch_pedantic_no_totag uploaded by flefoll (license
244)

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

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

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
02-25-08 09:13  svnbot         Checkin                                      
02-25-08 09:13  svnbot         Note Added: 0082849                          
02-25-08 09:13  svnbot         Status                   new => assigned     
02-25-08 09:13  svnbot         Assigned To               => file            
======================================================================




More information about the asterisk-bugs mailing list