[asterisk-commits] russell: branch 1.8 r359259 - in /branches/1.8: include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 14 05:52:47 CDT 2012


Author: russell
Date: Wed Mar 14 05:52:45 2012
New Revision: 359259

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=359259
Log:
Fix bogus reads/writes of console log levels in asterisk.c 

This patch updates the NUMLOGLEVELS define in logger.h to 32, to match the fact
that logger.c implements 32 log levels (because of the custom log level stuff).
asterisk.c uses this define to size an array of levels per remote console.

This array is modified in ast_console_toggle_loglevel(), which is called by the
"logger set level" CLI command.  While the documentation for the CLI command
doesn't make it terribly obvious, you can use this CLI command to toggle a
custom log level on a remote console, as well.  However, doing so led to an
invalid array index in asterisk.c.

This array is read from any time a log message is written to a console.  So, 
all custom log level messages resulted in a bogus read if a remote console
was connected.

Modified:
    branches/1.8/include/asterisk/logger.h
    branches/1.8/main/logger.c

Modified: branches/1.8/include/asterisk/logger.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/include/asterisk/logger.h?view=diff&rev=359259&r1=359258&r2=359259
==============================================================================
--- branches/1.8/include/asterisk/logger.h (original)
+++ branches/1.8/include/asterisk/logger.h Wed Mar 14 05:52:45 2012
@@ -181,7 +181,7 @@
 #endif
 #define AST_LOG_DTMF    __LOG_DTMF, _A_
 
-#define NUMLOGLEVELS 7
+#define NUMLOGLEVELS 32
 
 /*!
  * \brief Get the debug level for a module

Modified: branches/1.8/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/logger.c?view=diff&rev=359259&r1=359258&r2=359259
==============================================================================
--- branches/1.8/main/logger.c (original)
+++ branches/1.8/main/logger.c Wed Mar 14 05:52:45 2012
@@ -162,7 +162,7 @@
  * logchannels list.
  */
 
-static char *levels[32] = {
+static char *levels[NUMLOGLEVELS] = {
 	"DEBUG",
 	"---EVENT---",		/* no longer used */
 	"NOTICE",
@@ -173,7 +173,7 @@
 };
 
 /*! \brief Colors used in the console for logging */
-static const int colors[32] = {
+static const int colors[NUMLOGLEVELS] = {
 	COLOR_BRGREEN,
 	COLOR_BRBLUE,		/* no longer used */
 	COLOR_YELLOW,




More information about the asterisk-commits mailing list