mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 19:52:48 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@119892 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -133,9 +133,9 @@ struct logmsg {
|
|||||||
enum logmsgtypes type;
|
enum logmsgtypes type;
|
||||||
char date[256];
|
char date[256];
|
||||||
int level;
|
int level;
|
||||||
const char *file;
|
char file[80];
|
||||||
int line;
|
int line;
|
||||||
const char *function;
|
char function[80];
|
||||||
AST_LIST_ENTRY(logmsg) list;
|
AST_LIST_ENTRY(logmsg) list;
|
||||||
char str[0];
|
char str[0];
|
||||||
};
|
};
|
||||||
@@ -1148,9 +1148,9 @@ void ast_log(int level, const char *file, int line, const char *function, const
|
|||||||
|
|
||||||
/* Copy over data */
|
/* Copy over data */
|
||||||
logmsg->level = level;
|
logmsg->level = level;
|
||||||
logmsg->file = file;
|
|
||||||
logmsg->line = line;
|
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 the logger thread is active, append it to the tail end of the list - otherwise skip that step */
|
||||||
if (logthread != AST_PTHREADT_NULL) {
|
if (logthread != AST_PTHREADT_NULL) {
|
||||||
|
Reference in New Issue
Block a user