Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_header for [last_From] searches SIPp body too #207

Closed
wdoekes opened this issue Mar 23, 2016 · 0 comments
Closed

get_header for [last_From] searches SIPp body too #207

wdoekes opened this issue Mar 23, 2016 · 0 comments
Milestone

Comments

@wdoekes
Copy link
Member

wdoekes commented Mar 23, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant