aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-03 13:30:39 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-03 13:30:39 +0000
commitf87c6e2e5524ac2a0cda88802b4f1f475af80aa1 (patch)
treec46e855d02191d487276de5090bdab83e2da7e80 /main
parent4721a0182e0401b9f1ecf9e74c583c10851e5364 (diff)
Merged revisions 119892 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r119892 | russell | 2008-06-03 08:29:16 -0500 (Tue, 03 Jun 2008) | 9 lines 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 ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@119893 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/logger.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/main/logger.c b/main/logger.c
index 9fb415bf5..173fe5d24 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -133,9 +133,9 @@ struct logmsg {
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];
};
@@ -1047,7 +1047,7 @@ void ast_log(int level, const char *file, int line, const char *function, const
/* Create a new logging message */
if (!(logmsg = ast_calloc(1, sizeof(*logmsg) + res + 1)))
return;
-
+
/* Copy string over */
strcpy(logmsg->str, buf->str);
@@ -1060,9 +1060,9 @@ void ast_log(int level, const char *file, int line, const char *function, const
/* 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) {