Summary: | ASTERISK-09850: Asterisk crashes on GROUP_COUNT with a category | ||
Reporter: | mlegas (mlegas) | Labels: | |
Date Opened: | 2007-07-10 09:14:09 | Date Closed: | 2007-07-10 09:35:05 |
Priority: | Critical | Regression? | No |
Status: | Closed/Complete | Components: | Functions/func_groupcount |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | Asterisk 1.4.6 running on a Linux Debian Sarge kernel 2.4 A calls B and sets a GROUP with name A with no category while on call, A receives a call through a macro that tries to execute GROUP_COUNT(A@mycategory) ast_app_group_get_count tries to search a corresponding group and category within the list and then crashes because it finds a corresponding group but the category is empty and the string comparison causes a crash here: if (!strcasecmp(gi->group, group) && (ast_strlen_zero(category) || !strcasecmp(gi->category, category))) gi->category is NULL in that case from the core dump: #0 0x402217df in strcasecmp () from /lib/libc.so.6 (gdb) bt #0 0x402217df in strcasecmp () from /lib/libc.so.6 #1 0x0805f3eb in ast_app_group_get_count (group=0xbd7ece64 "0178164006", category=0xbd7ece14 "qmember") at strings.h:34 ASTERISK-58 0x080b9d9d in pbx_substitute_variables_helper_full (c=0x8218c08, headp=0xbd7edefc, cp1=0xbd7edf08 "0178164006@qmember", cp2=0xbd7ecefc "", count=4096) at pbx.c:1105 ASTERISK-59 0x080b9d9d in pbx_substitute_variables_helper_full (c=0x8218c08, headp=0x8218f4c, cp1=0xbd7f0f7c "${GROUP_COUNT(${ARG1}@qmember)}=0", cp2=0xbd7eff7c "", count=4095) at pbx.c:1105 ASTERISK-60 0x080ba1fa in pbx_substitute_variables_helper_full (c=0x8218c08, headp=0x8218f4c, cp1=0x8200110 "$[${GROUP_COUNT(${ARG1}@qmember)}=0]?dial:NOANSWER", cp2=0xbd7f61a4 "", count=8191) at pbx.c:1720 ASTERISK-61 0x080ba317 in pbx_substitute_variables_helper (c=0x402c1b60, cp1=0xbd7ffd90 "`\033,@`\025,@\234?\177?", cp2=0xbd7ffd90 "`\033,@`\025,@\234?\177?", count=-1115685488) at pbx.c:1741 ASTERISK-62 0x080c2a3c in pbx_extension_helper (c=0x8218c08, con=0xbd7ffd90, context=0x8218d88 "macro-stdext-qmember", exten=0x8218dd8 "s", priority=2, label=0x0, callerid=0x40b95920 "anonymous", action=136416264) at pbx.c:1805 ASTERISK-63 0x080c0c72 in ast_spawn_extension (c=0xbd7ffd90, context=0xbd7ffd90 "`\033,@`\025,@\234?\177?", exten=0xbd7ffd90 "`\033,@`\025,@\234?\177?", priority=-1115685488, callerid=0xbd7ffd90 "`\033,@`\025,@\234?\177?") at pbx.c:2288 ASTERISK-64 0x40c0b440 in macroif_exec (chan=0x8218c08, data=0x8218c08) at app_macro.c:344 ASTERISK-65 0x40c0a95e in macro_exec (chan=0x8218c08, data=0x40b67f20) at app_macro.c:209 ASTERISK-66 0x080c2af2 in pbx_extension_helper (c=0x8218c08, con=0xbd7ffd90, context=0x8218d88 "macro-stdext-qmember", exten=0x8218dd8 "s", priority=1, label=0x0, callerid=0x40b95920 "anonymous", action=136416264) at pbx.c:532 ASTERISK-67 0x080c3731 in __ast_pbx_run (c=0x8218c08) at pbx.c:2288 ASTERISK-68 0x080c45d1 in pbx_thread (data=0xbd7ffd90) at pbx.c:2601 ASTERISK-69 0x080f2e99 in dummy_start (data=0x402c1b60) at utils.c:545 ASTERISK-70 0x40027e51 in pthread_start_thread () from /lib/libpthread.so.0 ASTERISK-71 0x402818aa in clone () from /lib/libc.so.6 ****** ADDITIONAL INFORMATION ****** here is a proposed fix in ast_app_group_get_count from app.c : if (!strcasecmp(gi->group, group) && (ast_strlen_zero(category) || (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, category)))) same applies to ast_app_group_match_get_count | ||
Comments: | By: Digium Subversion (svnbot) 2007-07-10 09:31:16 Repository: asterisk Revision: 74264 ------------------------------------------------------------------------ r74264 | file | 2007-07-10 09:31:15 -0500 (Tue, 10 Jul 2007) | 2 lines Ensure the group information category exists before trying to do a string comparison with it. (issue ASTERISK-9850 reported by mlegas) ------------------------------------------------------------------------ By: Digium Subversion (svnbot) 2007-07-10 09:33:16 Repository: asterisk Revision: 74265 ------------------------------------------------------------------------ r74265 | file | 2007-07-10 09:33:16 -0500 (Tue, 10 Jul 2007) | 10 lines Merged revisions 74264 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r74264 | file | 2007-07-10 11:48:00 -0300 (Tue, 10 Jul 2007) | 2 lines Ensure the group information category exists before trying to do a string comparison with it. (issue ASTERISK-9850 reported by mlegas) ........ ------------------------------------------------------------------------ By: Digium Subversion (svnbot) 2007-07-10 09:34:24 Repository: asterisk Revision: 74266 ------------------------------------------------------------------------ r74266 | file | 2007-07-10 09:34:23 -0500 (Tue, 10 Jul 2007) | 18 lines Merged revisions 74265 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r74265 | file | 2007-07-10 11:50:00 -0300 (Tue, 10 Jul 2007) | 10 lines Merged revisions 74264 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r74264 | file | 2007-07-10 11:48:00 -0300 (Tue, 10 Jul 2007) | 2 lines Ensure the group information category exists before trying to do a string comparison with it. (issue ASTERISK-9850 reported by mlegas) ........ ................ ------------------------------------------------------------------------ |