[OpenSIPS-Devel] bug in t_msgbuilder.c

Kennard White kennard_white at logitech.com
Wed Nov 3 19:37:14 CET 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/devel/attachments/20101103/80f4f1e7/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opensips-tmbuild.patch
Type: application/octet-stream
Size: 3757 bytes
Desc: not available
Url : http://lists.opensips.org/pipermail/devel/attachments/20101103/80f4f1e7/attachment.obj 


More information about the Devel mailing list