Thanks to visit codestin.com
Credit goes to github.com

Skip to content

get_header for [last_From] searches SIPp body too #207

@wdoekes

Description

@wdoekes

Zoltan.Toth wrote on sipp-users list:


Hello,

I have a test case where SIPp receives a SIP message carrying a message body with CPIM content (the below extracts are simplified to reflect only the problematic message elements):

UDP message received

INVITE sip:user@host:port SIP/2.0 
From: tel:2110;tag=697848969de74321800c6ec5de2f3236 
To: sip:[email protected] 
[...] 
Content-Type: multipart/mixed;boundary=++ 

--++ 
Content-Type: application/sdp 
[...] 
--++ 
Content-Type: message/cpim 
[...] 
From: <sip:[email protected]> 
To: <sip:[email protected]> 
[...] 
--++-- 

CPIM messages can contain From and To headers, and using [last_From:] and [last_To:] on the above message when sending a response yields:

UDP message sent 

SIP/2.0 100 Trying 
From: tel:2110;tag=697848969de74321800c6ec5de2f3236, <sip:[email protected]> 
To: sip:[email protected], <sip:[email protected]> 
[...] 

Which is not desirable.

The reason is that the get_header method in sip_parser.cpp searches through the entire message, including the message body.

Proposed solution:

*** sip_parser_orig.cpp Thu Mar 17 01:05:48 2016 
--- sip_parser.cpp      Tue Mar 22 12:59:13 2016 
*************** char * get_header(const char* message, c 
*** 139,144 **** 
--- 139,150 ---- 
      } 

      src_orig = strdup(message); 
+ 
+     /* find end of SIP headers - perform search only until that */ 
+     ptr = strstr(src_orig, "\r\n\r\n"); 
+     if (ptr) { 
+         *ptr = 0; 
+     } 

      do { 
          /* We want to start from the beginning of the message each time 

Please comment.

Cheers,
Zoltan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions