bugThe oSIP library - Bugs: bug #53037, Failure to parse header with...

 
 

bug #53037: Failure to parse header with escaped quotes

Submitter:  Pierre Bodilis <kerlu>
Submitted:  Thu 01 Feb 2018 03:40:08 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  aymeric
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 21 Mar 2018 05:52:45 PM UTC, comment #3: 

I have pushed a commit:

    http://git.savannah.gnu.org/cgit/osip.git/commit/?id=9966af770f8383ee7bec9b756fd8d614725455d4

It includes:
1/ your bug fix patch
2/ a change in design: only header which are defined to support the COMMA usage will be checked. Other headers, as well as unknown headers will be parsed as being ONE header, even if a COMMA is found.
3/ A new API (parser_add_comma_separated_header) is offered for adding any header that user want the stack to be decoded as multiple header on one line.

Tks a lot for the report.
Aymeric

Aymeric MOIZARD <aymeric>
Group administrator
Wed 21 Mar 2018 08:25:33 AM UTC, comment #2: 

No problem, I'm currently using my patched version of osip.



> "I have decided to handle multiple header in a different way for the future: a list of header which can be separated with comma will be build in osip, and osip will only search in those headers for escaped sequence, uris, etc... "


You mean that you'll split only a specific list of headers on commas?

Pierre Bodilis <kerlu>
Tue 20 Mar 2018 05:45:08 PM UTC, comment #1: 

I had a report in April/May 2014 along with a patch.
The patch was unfortunatly partially correct and introduced the bug.

The commit was made on Wed May 7.(82e040dccf8133b84d7f3c005d5f4508122bf55f)

I have decided to handle multiple header in a different way for the future: a list of header which can be separated with comma will be build in osip, and osip will only search in those headers for escaped sequence, uris, etc...

I will also fix the bug with your patch.

-again, sorry for the delay: obviously, I had no savannah report that you filled a bug...-

Tks
Aymeric

Aymeric MOIZARD <aymeric>
Group administrator
Thu 01 Feb 2018 03:40:08 PM UTC, original submission:  

I have a custom made sip header containing a escaped quote json string (I know that's bad, but can't do otherwise for now):
test: "{\"test1\":{\"foo1\":[\"ba,r11\"],\"foo2\":[\"bar21\",\"bar22\"]}}"

the current function `osip_message_set_multiple_header` fails to parse this string, although it should (reading the code)



Index: lib/libosip2-5.0.0/src/osipparser2/osip_message_parse.c
===================================================================
--- lib/libosip2-5.0.0/src/osipparser2/osip_message_parse.c     (revision 26018)
+++ lib/libosip2-5.0.0/src/osipparser2/osip_message_parse.c     (working copy)
@@ -494,7 +494,7 @@
     {
     case '"':
       /* Check that the '"' is not escaped */
-      for (i = 0, p = ptr; p >= beg && *p == '\\'; p--, i++);
+      for (i = 0, p = ptr - 1; p >= beg && *p == '\\'; p--, i++);
       if (i % 2 == 0)
         inquotes = !inquotes; /* the '"' was not escaped */
       break;

Pierre Bodilis <kerlu>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by aymeric (Posted a comment)
  • -email is unavailable- added by kerlu (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-21 aymeric StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2018-03-20 aymeric StatusNone In Progress
        Assigned toNone aymeric

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code