[asterisk-bugs] [Asterisk 0010858]: Segfault if ast_cli_register is called multiple times with same data

noreply at bugs.digium.com noreply at bugs.digium.com
Mon Oct 1 09:36:01 CDT 2007


The following issue has been ASSIGNED. 
====================================================================== 
http://bugs.digium.com/view.php?id=10858 
====================================================================== 
Reported By:                jamesgolovich
Assigned To:                russell
====================================================================== 
Project:                    Asterisk
Issue ID:                   10858
Category:                   Core-General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
Asterisk Version:            SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 84149 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             10-01-2007 00:39 CDT
Last Modified:              10-01-2007 09:36 CDT
====================================================================== 
Summary:                    Segfault if ast_cli_register is called multiple
times with same data
Description: 
This was brought to my attention by the bug I just opened
http://bugs.digium.com/view.php?id=10856.  There
are 2 calls to ast_cli_register(&cli_refresh).  When the 2nd one gets
called, it clearly already exists so if we call ast_free(e->_full_cmd); and
set it to NULL then the next time that list gets walked we segfault.

Just commenting out those 2 lines (in __ast_cli_register about line 1416)
stops the issue, but there might be some memory left hanging around.  I
haven't had a chance to dive into the NEW_CLI stuff, so I'm not sure what
the best solution here is.
====================================================================== 

---------------------------------------------------------------------- 
 svnbot - 10-01-07 09:36  
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 84169

U   trunk/main/cli.c

------------------------------------------------------------------------
r84169 | russell | 2007-10-01 09:36:00 -0500 (Mon, 01 Oct 2007) | 7 lines

Don't set the full command string until after verifying that there is not
another CLI command with the same command text registered.  This prevents
a crash if someone accidentally calls ast_cli_register()  on the same CLI
command data twice.  This also fixes a small bug where the helpers list
would get unlocked without being locked if building the full command
failed.
(closes issue http://bugs.digium.com/view.php?id=10858, reported by
jamesgolovich, patched by me)

------------------------------------------------------------------------ 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
10-01-07 09:36  svnbot         Note Added: 0071243                          
10-01-07 09:36  svnbot         Status                   new => assigned     
10-01-07 09:36  svnbot         Assigned To               => russell         
======================================================================




More information about the asterisk-bugs mailing list