[sr-dev] [kamailio/kamailio] janssonrpcc: Fix invalid memory access by zero terminating str, cleanups (#2512)

Daniel-Constantin Mierla notifications at github.com
Tue Oct 20 09:58:50 CEST 2020


The `len` field will not include the 0, so copying such a cloned value will not be affected by ending 0. Besides the str fields that point in larger buffers (like with the sip parser fields that point inside msg->buf), most of the other str->s values are 0 terminating (e.g., most of pseudo-variables values, functions parameters evaluated by fixup_get_svalue(), ...). I am sure there are way more 0-terminated str->s fields than the non-0-terminated.

Again, here we discuss about cloning values, their result is not impacting anything else, they are supposed to be independent of other resources.

The rule is more like: do not rely on 0-terminated str->s value unless you are sure it is.

In this case it is made sure to be 0-terminated and used accordingly.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2512#issuecomment-712668915
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20201020/edc69a81/attachment.htm>


More information about the sr-dev mailing list