]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix bogus reads/writes of console log levels in asterisk.c
authorRussell Bryant <russell@russellbryant.com>
Wed, 14 Mar 2012 10:54:50 +0000 (10:54 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 14 Mar 2012 10:54:50 +0000 (10:54 +0000)
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.
........

Merged revisions 359259 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@359260 65c4cc65-6c06-0410-ace0-fbb531ad65f3

include/asterisk/logger.h
main/logger.c

index 9363caa748f773d80efbfb21aa7f13561fed31e9..73e95ca2159a6c3667fa73004535c5f8794463f5 100644 (file)
@@ -181,7 +181,7 @@ void ast_console_toggle_loglevel(int fd, int level, int state);
 #endif
 #define AST_LOG_DTMF    __LOG_DTMF, _A_
 
-#define NUMLOGLEVELS 7
+#define NUMLOGLEVELS 32
 
 /*!
  * \brief Get the debug level for a module
index 5f0416986b56b398c2c6252f435c1481ceea17bc..4d88aa688987b419bba98de0caa8f7e48d57def2 100644 (file)
@@ -153,7 +153,7 @@ static FILE *qlog;
  * logchannels list.
  */
 
-static char *levels[32] = {
+static char *levels[NUMLOGLEVELS] = {
        "DEBUG",
        "---EVENT---",          /* no longer used */
        "NOTICE",
@@ -164,7 +164,7 @@ static char *levels[32] = {
 };
 
 /*! \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,