bugThe oSIP library - Bugs: bug #55951, Failure to parse SIP MESSAGE with...

 
 

bug #55951: Failure to parse SIP MESSAGE with image attached (bis)

Submitter:  Pierre Bodilis <kerlu>
Submitted:  Mon 18 Mar 2019 08:23:07 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
   

Mon 13 Jan 2020 09:44:25 AM UTC, comment #3: 

Hi Pierre,

Sorry for delay.

I have merged the proposed change with a minor change.

http://git.savannah.gnu.org/cgit/osip.git/commit/?id=0a278cfbcaeb900c7bacabc72bd10405118a7664

Thanks a lot
Aymeric

Aymeric MOIZARD <aymeric>
Group administrator
Thu 28 Mar 2019 07:58:01 PM UTC, comment #2: 

Hi!

It's unfortunate, but I just made a new release...
And coming to the website for the release, I've seen your report. -and no notifications received in my emails-...

I will check it later, but unfortunatly, it's too late for libosip5.1.0...

Tks!
Aymeric

Aymeric MOIZARD <aymeric>
Group administrator
Tue 19 Mar 2019 08:31:15 AM UTC, comment #1: 



int
__osip_find_next_occurence (const char *str, const char *buf, const char **index_of_str, const char *end_of_buf)
{
  int i;
  *index_of_str = NULL;         /* AMD fix */

  size_t slen = strlen(str);
  while (slen < end_of_buf - buf) {
    if (!memcmp(str, buf, slen)) {
        *index_of_str = buf;
        return OSIP_SUCCESS;
    }
    ++buf;
  }

  OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_BUG, NULL, "Could not find given string in the provided buffer\n"));
  return OSIP_SYNTAXERROR;
}



Pierre Bodilis <kerlu>
Mon 18 Mar 2019 08:23:07 PM UTC, original submission:  

Follow up on https://savannah.gnu.org/bugs/?func=detailitem&item_id=55930#options (and I realize I posted this post as anonymous :/)

Here's a fix I like better to the hackish one I posted last Friday:

int
__osip_find_next_occurence (const char str, const char *buf, const char *index_of_str, const char *end_of_buf)
{
  int i;
  index_of_str = NULL;         / AMD fix */

  size_t slen = strlen(str);
  while (slen < end_of_buf - buf) {
    if (!memcmp(str, buf, slen)) {
        *index_of_str = buf;
        return OSIP_SUCCESS;
    }
    ++buf;
  }

  OSIP_TRACE (osip_trace (_FILE_, _LINE_, OSIP_BUG, NULL, "Could not find given string in the provided buffer\n"));
  return OSIP_SYNTAXERROR;
}


memcmp is as strict as strstr (initial code was case unsensitive), and avoid falling in the null terminated string. Agreed, it's not as effective as glibc's two_way_short_needle, but at least, it parses all messages, regardless of their length.

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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-13 aymeric StatusNone Fixed
        Open/ClosedOpen Closed
    2019-03-28 aymeric Assigned toNone aymeric

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code