[sr-dev] set_ruri_host crash
Daniel-Constantin Mierla
miconda at gmail.com
Fri Apr 7 15:39:14 CEST 2017
Thanks, I just pushed a patch, can you try it?
Cheers,
Daniel
On 07.04.17 15:32, Juha Heinanen wrote:
> Daniel-Constantin Mierla writes:
>
>> What OS do you have and which version of gdb? The list command should
>> list the code around the line where the crash happens, but it doesn't do
>> it for you.
> this is debian jessie with GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1.
>
>> Anyhow, you can extract the code around src/modules/pv/pv_core.c:2243
>> and send it here, to be sure it is the one you use at the time of
>> crash.
> i built new deb from latest master and re-run the crash. gdb tells:
>
> 2238 pv_core.c: No such file or directory.
> (gdb) wher
> #0 0x00007f35327933e0 in pv_set_ruri_host (msg=0x7f353f529dc0,
> param=0x7f353ebc8400, op=254, val=0x7fff67072c60) at pv_core.c:2238
> #1 0x00000000005964dc in lval_pvar_assign (h=0x7fff67073410,
> msg=0x7f353f529dc0, lv=0x7f353ebc8380, rv=0x7f353ebc8a58)
> at core/lvalue.c:351
> #2 0x0000000000596eed in lval_assign (h=0x7fff67073410, msg=0x7f353f529dc0,
> lv=0x7f353ebc8380, rve=0x7f353ebc8a50) at core/lvalue.c:399
> ...
>
> (gdb) frame 0
> #0 0x00007f35327933e0 in pv_set_ruri_host (msg=0x7f353f529dc0,
> param=0x7f353ebc8400, op=254, val=0x7fff67072c60) at pv_core.c:2238
> 2238 in pv_core.c
> (gdb) list
> 2233 in pv_core.c
> (gdb)
>
> and pv_core.c:2238 is marked below.
>
> -- juha
>
> -------------------------------------------------------------------------
>
> int pv_set_ruri_host(struct sip_msg* msg, pv_param_t *param,
> int op, pv_value_t *val)
> {
> struct action act;
> struct run_act_ctx h;
> char backup;
>
> if(msg==NULL || param==NULL || val==NULL || (val->flags&PV_VAL_NULL))
> {
> LM_ERR("bad parameters\n");
> return -1;
> }
>
> if(!(val->flags&PV_VAL_STR))
> {
> LM_ERR("str value required to set R-URI hostname\n");
> goto error;
> }
>
> memset(&act, 0, sizeof(act));
> act.val[0].type = STRING_ST;
> act.val[0].u.string = val->rs.s;
> backup = val->rs.s[val->rs.len];
> val->rs.s[val->rs.len] = '\0'; ********** this
> act.type = SET_HOST_T;
> init_run_actions_ctx(&h);
> if (do_action(&h, &act, msg)<0)
> {
> LM_ERR("do action failed\n");
> val->rs.s[val->rs.len] = backup;
> goto error;
> }
> val->rs.s[val->rs.len] = backup;
>
> return 0;
> error:
> return -1;
> }
--
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - May 22-24 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
More information about the sr-dev
mailing list