[sr-dev] fixup causing crash in rtpproxy-ng module

Daniel-Constantin Mierla miconda at gmail.com
Tue Sep 3 21:51:55 CEST 2013


Hello,

On 9/3/13 6:16 PM, Hugh Waite wrote:
> Hello,
> I have discovered another crash in the mediaproxy-ng module.
> The config line that causes it is:
> rtpproxy_manage("fco+SP", $hdr(X-Origin-IP));
> where the hdr PV holds a valid IP address.
> I think this is an issue with the fixup functions, but different 
> functions have different ways of converting. Can someone explain which 
> is the current recommended format?
>
> static cmd_export_t cmds[] = {
> ...
>         {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f,     2,
>                 fixup_spve_spve, 0,
>                 ANY_ROUTE},
>         {"rtpproxy_manage", (cmd_function)rtpproxy_manage2,     2,
>                 fixup_spve_str, fixup_free_spve_str,
>                 ANY_ROUTE},
> ...
> static int
> rtpproxy_offer2_f(struct sip_msg *msg, char *param1, char *param2)
> {
>         str flags, new_ip;
>
>         get_str_fparam(&flags, msg, (fparam_t *) param1);
>         get_str_fparam(&new_ip, msg, (fparam_t *) param2);
>         return force_rtp_proxy(msg, flags.s, &new_ip, OP_OFFER);
> }
> static int
> rtpproxy_manage2(struct sip_msg *msg, char *flags, char *ip)
> {
>         str flag_str;
>         str ip_str;
>         fixup_get_svalue(msg, (gparam_p)flags, &flag_str);
>         fixup_get_svalue(msg, (gparam_p)ip, &ip_str);
>         return rtpproxy_manage(msg, flag_str.s, &ip_str);
> }
>
> If the function uses fixup_spve_str, should rtpproxy_manage2() be 
> using get_str_fparam() instead of fixup_get_svalue() for the second 
> parameter (or even both parameters)?
>
> I notice that rtpproxy_offer2_f() is using get_str_fparam() for both 
> parameters when the fixup function is fixup_spve_spve, and there is no 
> fixup_free function.

iirc, 'str' as part of a fixup function name is converting the 'char*' 
parameter to 'str*'. As you give a variable parameter, change the fixup 
function from fixup_spve_str to fixup_spve_spve and the fixup-free to 
fixup_free_spve_spve.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Trainings - Berlin, Oct 21-24; Miami, Nov 11-13, 2013
   - more details about Kamailio trainings at http://www.asipto.com -




More information about the sr-dev mailing list