[sr-dev] [kamailio/kamailio] crash related to functions in cfg file parser for invalid cfg (#2239)

Henning Westerholt notifications at github.com
Thu Mar 5 18:41:06 CET 2020


Against current git master.

```
henning at static:~/repositories/kamailio$ cat etc/crash-4.cfg
#!KAMAILIO

loadmodule "sl.so"

request_route {
        switch (1) {
                case -1:
                        send_reply("404", "Not Found");
                case -2:
                        send_reply("405",("Method Not Allowed");
        exit;
}

```

> $ ./src/kamailio -f etc/crash-4.cfg -L src/modules/ -Y /tmp -E -d
>  0(2278) CRITICAL: <core> [core/cfg.y:3549]: yyerror_at(): parse error in config file /home/henning/repositories/kamailio/etc/crash-4.cfg, line 10, column 43: syntax error
>  0(2278) CRITICAL: <core> [core/cfg.y:3549]: yyerror_at(): parse error in config file /home/henning/repositories/kamailio/etc/crash-4.cfg, line 10, column 43: '('')' expected (function call)
> Segmentation fault (core dumped)
> henning at static:~/repositories/kamailio$ gdb src/kamailio core
> Reading symbols from src/kamailio...done.
> [New LWP 2278]
> Core was generated by `./src/kamailio -f etc/crash-4.cfg -L src/modules/ -Y /tmp -E -d'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  0x00005580cdbd131e in append_action (a=0x7fad84db9300, b=0x7fad84db97f8) at core/route_struct.c:147
> 147             for(t=a; t->next; t=t->next);
> (gdb) bt
> #0  0x00005580cdbd131e in append_action (a=0x7fad84db9300, b=0x7fad84db97f8) at core/route_struct.c:147
> #1  0x00005580cdf9208b in yyparse () at core/cfg.y:2428
> #2  0x00005580cdb96c11 in main (argc=9, argv=0x7ffc2d9f6a68) at main.c:2309
> (gdb) f 0
> #0  0x00005580cdbd131e in append_action (a=0x7fad84db9300, b=0x7fad84db97f8) at core/route_struct.c:147
> 147             for(t=a; t->next; t=t->next);
> (gdb) p a
> $1 = (struct action *) 0x7fad84db9300
> (gdb) p b
> $2 = (struct action *) 0x7fad84db97f8
> (gdb) p t
> $3 = (struct action *) 0x80
> (gdb) p a->next
> $4 = (struct action *) 0x80
> (gdb) p *t
> Cannot access memory at address 0x80

-- 
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/issues/2239
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20200305/2c2b7274/attachment.html>


More information about the sr-dev mailing list