You can relocate those functions and related code in one of the pv*.{c,h} in the core.

Cheers,
Daniel

On 28/04/16 11:00, Jason Penton wrote:
Does anybody know if there is an existing library function/s to copy a sip_msg (typically request) from shm to pkg? I know there is already this functionality in the tmx module but I think it would be useful to move this into a library so it can be used by other modules? I am just wanting to make sure before I replicate code...

Reason for such functionality:

The main reason is where modules need to access specific headers from a sip request which they get from t->uas.request (generally in instances where only the rpl message is accessible). We all know that t->uas.request sits in SHM, so if any additional parsing is done on this message it's pointers will be polluted with pvt memory addresses of the processing parsing the request. This could ultimately lead to memory corruption and segfaults.

I would therefore propose moving the pv_t_copy_msg and associated functions from tmx modules into the core library... any objections?

Cheers
Jason 


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla
http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, Berlin, May 18-20, 2016 - http://www.kamailioworld.com