[OpenSIPS-Devel] [opensips] sipmsgops: calling remove_hf twice can lead to malformed messages or even crashes (#137)

Ovidiu Sas notifications at github.com
Mon Nov 25 18:50:05 CET 2013


By calling remove_hf using a wildcard and the calling remove_hf for a specific header that was already removed previously by the wildcard pattern triggers malformed messages and sometimes crashes.

Example of a malformed packet triggered by:
...
    if (is_present_hf("User-Agent")) {
        remove_hf("User-A*", "g");
        remove_hf("User-Agent");
    }
...


And the outgoing INVITE looks like:
INVITE sip:4165551111 at 192.168.2.97:5062 SIP/2.0.
Record-Route: <sip:192.168.2.3;lr;did=1.3b4c7b54>.
Via: SIP/2.0/UDP 192.168.2.3:5060;branch=z9hG4bKa078.545ba521.0.
Via: SIP/2.0/UDP 192.168.2.2:5060;received=192.168.2.2;branch=z9hG4bK17356ec3;rport=5060.
Max-Forwards: 69.
From: "Ovidiu Sas PBX " <sip:osas at 192.168.2.2>;tag=as77cfb2a7.
To: <sip:4165551111 at 192.168.2.3>.
Contact: <sip:osas at 192.168.2.2:5060>.
Call-ID: 403944a939ca8ea85b2b2b344cc33ed5 at 192.168.2.2:5060.
CSeq: 102 INVITE.
 2013 17:47:25 GMT.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH.
Supported: replaces, timer.
Content-Type: application/sdp.
Content-Length: 290.


See the Cseq header.  The received headers:
Call-ID: 403944a939ca8ea85b2b2b344cc33ed5 at 192.168.2.2:5060.
CSeq: 102 INVITE.
User-Agent: PBX.
Date: Mon, 25 Nov 2013 17:47:25 GMT.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH.


The Date header was overwritten.


Regards,
Ovidiu Sas

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/137
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20131125/0aeb990f/attachment.html>


More information about the Devel mailing list