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, view it on GitHub, or unsubscribe.