[OpenSIPS-Devel] bug in t_msgbuilder.c

Kennard White kennard_white at logitech.com
Thu Nov 4 16:12:14 CET 2010


Another developer was doing some client-side development, and noticed the
extra byte at the end of a CANCEL message.

Kennard

On Thu, Nov 4, 2010 at 2:59 AM, Bogdan-Andrei Iancu
<bogdan at voice-system.ro>wrote:

> Hi Kennard,
>
> Thanks for the fix - it a very stupid bug...hard to imagine how 1 ended
> up instead of 0 :-/
>
> I applied your patch with the fix only - I try to sync the code with the
> 1.6 branch to make the backporting easier.
>
> BTW, how you spotted it - some trailing chars in ACKs and CANCELs ?
>
> REgards,
> Bogdan
>
> Kennard White wrote:
> > Hi,
> >
> > There appears to be a minor bug in t_msgbuilder.c in HEAD. The
> > build_local() function is off-by-one when computing the length of the
> > message it is going to build. End result is that locally generated
> > messages (CANCEL and some ACKs) have an extra garbage byte at end of
> > message. The garbage byte happens to be a null. Other SIP stacks
> > complain about this extra byte.
> >
> > The problem is this:
> >            (Trans->extra_hdrs.s?Trans->extra_hdrs.len:1)
> > The "1" should be a "0" to be consistent with the later code.
> >
> > I've included patch that fixed this and changes the length computation
> > to match the order in which the message it built. It also breaks up
> > the length computation into groups. Goal is to make it easier to find
> > future length computation errors -- took 4 hours to find this
> > relatively simple error. I also added a final assert -- not sure what
> > the opensips policy is on asserts.
> >
> > Thanks,
> > Kennard
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Devel mailing list
> > Devel at lists.opensips.org
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
> >
>
>
> --
> Bogdan-Andrei Iancu
> OpenSIPS Bootcamp
> 15 - 19 November 2010, Edison, New Jersey, USA
> www.voice-system.ro
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/devel/attachments/20101104/f487b0df/attachment.htm 


More information about the Devel mailing list