summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2012-03-14 10:56:53 +0000
committerRussell Bryant <russell@russellbryant.com>2012-03-14 10:56:53 +0000
commit00b270833f3d5a58ab2acbcce1c5a16b0330aaeb (patch)
treefa6a02961aaeb6449becdcf7ff9fc2a80dcb85ad
parent6c9f009b6d208eeb656bc19ec2e1675f755c73a9 (diff)
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
-rw-r--r--include/asterisk/logger.h2
-rw-r--r--main/logger.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index 8fdc97e65..c7f260c49 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -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
diff --git a/main/logger.c b/main/logger.c
index 74b7dd190..1c13773df 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -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,