[asterisk-commits] russell: trunk r119892 - /trunk/main/logger.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 3 08:29:18 CDT 2008
Author: russell
Date: Tue Jun 3 08:29:16 2008
New Revision: 119892
URL: http://svn.digium.com/view/asterisk?view=rev&rev=119892
Log:
Do a deep copy of file and function strings to avoid a potential crash when
modules are unloaded.
(closes issue #12780)
Reported by: ys
Patches:
logger.diff uploaded by ys (license 281)
-- modified by me for coding guidelines
Modified:
trunk/main/logger.c
Modified: trunk/main/logger.c
URL: http://svn.digium.com/view/asterisk/trunk/main/logger.c?view=diff&rev=119892&r1=119891&r2=119892
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Tue Jun 3 08:29:16 2008
@@ -133,9 +133,9 @@
enum logmsgtypes type;
char date[256];
int level;
- const char *file;
+ char file[80];
int line;
- const char *function;
+ char function[80];
AST_LIST_ENTRY(logmsg) list;
char str[0];
};
@@ -1135,7 +1135,7 @@
/* Create a new logging message */
if (!(logmsg = ast_calloc(1, sizeof(*logmsg) + res + 1)))
return;
-
+
/* Copy string over */
strcpy(logmsg->str, buf->str);
@@ -1148,9 +1148,9 @@
/* Copy over data */
logmsg->level = level;
- logmsg->file = file;
logmsg->line = line;
- logmsg->function = function;
+ ast_copy_string(logmsg->file, file, sizeof(logmsg->file));
+ ast_copy_string(logmsg->function, function, sizeof(logmsg->function));
/* If the logger thread is active, append it to the tail end of the list - otherwise skip that step */
if (logthread != AST_PTHREADT_NULL) {
More information about the asterisk-commits
mailing list