summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorSteve Murphy <murf@digium.com>2008-08-02 04:51:29 +0000
committerSteve Murphy <murf@digium.com>2008-08-02 04:51:29 +0000
commit9051edfa4a6c02300f3cfe27b05bfe6fff6232eb (patch)
tree3e0c622f990675ca7a9145d76937c9d1c64684a0 /main
parent671627028c3dde78f2704485ae1b2f3d321e3436 (diff)
(closes issue #13202)
Reported by: falves11 Tested by: murf falves11 == The changes I introduce here seem to clear up the problem for me. However, if they do not for you, please reopen this bug, and we'll keep digging. The root of this problem seems to be a subtle memory corruption introduced when creating an extension with an empty extension name. While valgrind cannot detect it outside of DEBUG_MALLOC mode, when compiled with DEBUG_MALLOC, this is certain death. The code in main/features.c is a puzzle to me. On the initial module load, the code is attempting to add the parking extension before the features.conf file has even been opened! I just wrapped the offending call with an if() that will not try to add the extension if the extension name is empty. THis seems to solve the corruption, and let the "memory show allocations" work as one would expect. But, really, adding an extension with an empty name is a seriously bad thing to allow, as it will mess up all the pattern matching algorithms, etc. So, I added a statement to the add_extension2 code to return a -1 if this is attempted. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135265 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/features.c6
-rw-r--r--main/pbx.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/main/features.c b/main/features.c
index 9724cc85c..f540c455b 100644
--- a/main/features.c
+++ b/main/features.c
@@ -2911,8 +2911,10 @@ static struct ast_parkinglot *build_parkinglot(char *name, struct ast_variable *
/* Add a parking extension into the context */
if (!oldparkinglot) {
- if (ast_add_extension2(con, 1, ast_parking_ext(), 1, NULL, NULL, parkcall, strdup(""), ast_free, registrar) == -1)
- error = 1;
+ if (!ast_strlen_zero(ast_parking_ext())) {
+ if (ast_add_extension2(con, 1, ast_parking_ext(), 1, NULL, NULL, parkcall, strdup(""), ast_free, registrar) == -1)
+ error = 1;
+ }
}
ao2_unlock(parkinglot);
diff --git a/main/pbx.c b/main/pbx.c
index 7b904c8ff..9772ca53c 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -6808,6 +6808,12 @@ int ast_add_extension2(struct ast_context *con,
struct ast_exten dummy_exten = {0};
char dummy_name[1024];
+ if (ast_strlen_zero(extension)) {
+ ast_log(LOG_ERROR,"You have to be kidding-- add exten '' to context %s? Figure out a name and call me back. Action ignored.\n",
+ con->name);
+ return -1;
+ }
+
/* If we are adding a hint evalulate in variables and global variables */
if (priority == PRIORITY_HINT && strstr(application, "${") && !strstr(extension, "_")) {
struct ast_channel c = {0, };