osip-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[osip-dev] Issue with osip_message_parse


From: Paul Whitfield
Subject: [osip-dev] Issue with osip_message_parse
Date: Thu, 29 Jan 2015 03:09:23 +0000

Hi All,

 

I have come across and issue using osip2 in a particular application.

The device I am communicating with sends a SIP message with content that is encoded as UTF16.

This device is from a 3rd party so I cannot change it L

 

 

This caused the test in osip_message_parse.c to fail. The following test

 

   /* this is a *very* simple test... (which handle most cases...) */

    if (tmp[0] == '\0' || tmp[1] == '\0' || tmp[2] == '\0')

    {

        /* this is mantory in the oSIP stack */

        if (sip->content_length == NULL)

            osip_message_set_content_length(sip, "0");

        osip_free(beg);

        return OSIP_SUCCESS;    /* no body found */

    }

 

 

I propose the following fix:

 

 

    /* this is a *very* simple test... (which handle most cases...) */

    /* IGNORE this test if we have a content length */

    if ( ( ( sip->content_length == 0 ) || ( atoi(sip->content_length->value) == 0 ) ) &&

         ( (tmp[0] == '\0') || (tmp[1] == '\0' ) || (tmp[2] == '\0') ) )

    {

        /* this is mandatory in the oSIP stack */

        if (sip->content_length == NULL)

        {

            osip_message_set_content_length(sip, "0");

        }

        osip_free(beg);

        return OSIP_SUCCESS;    /* no body found */

    }

 

 

If this is acceptable I can make / send a patch against osip4.1.

 

 

Best regards

 

Paul Whitfield.

 

 

Example of the message that is causing the problem:

 

 

MESSAGE sip:address@hidden SIP/2.0

Via: SIP/2.0/UDP 192.168.20.203:5060;rport;branch=z9hG4bK7053

From: <sip:address@hidden>;tag=18062

To: <sip:address@hidden>

Call-ID: 8376

CSeq: 20 MESSAGE

Content-Type: text/plain; charset=utf-16

Max-Forwards: 70

User-Agent: HYTERA SIP 1.1

Ais-Reach: individual

Ais-Service: text-msg

Ais-Options: slot=1

Content-Length:    20

\000T\000h\000a\000n\000k\000 \000Y\000o\000u\000!

 

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]