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.
........

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

Merged revisions 359260 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359261 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/11.2
Russell Bryant 13 years ago
parent 6c9f009b6d
commit 00b270833f

@ -182,7 +182,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

@ -157,7 +157,7 @@ static FILE *qlog;
* logchannels list.
*/
static char *levels[32] = {
static char *levels[NUMLOGLEVELS] = {
"DEBUG",
"---EVENT---", /* no longer used */
"NOTICE",
@ -168,7 +168,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,

Loading…
Cancel
Save