Minor fixes
authorMark Spencer <markster@digium.com>
Tue, 29 Jul 2003 15:38:02 +0000 (15:38 +0000)
committerMark Spencer <markster@digium.com>
Tue, 29 Jul 2003 15:38:02 +0000 (15:38 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1235 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx.c
res/res_musiconhold.c

diff --git a/pbx.c b/pbx.c
index 9034762..00d53e0 100755 (executable)
--- a/pbx.c
+++ b/pbx.c
@@ -1115,8 +1115,10 @@ static int pbx_extension_helper(struct ast_channel *c, char *context, char *exte
                        app = pbx_findapp(e->app);
                        pthread_mutex_unlock(&conlock);
                        if (app) {
-                               strncpy(c->context, context, sizeof(c->context-1));
-                               strncpy(c->exten, exten, sizeof(c->exten)-1);
+                               if (c->context != context)
+                                       strncpy(c->context, context, sizeof(c->context-1));
+                               if (c->exten != exten)
+                                       strncpy(c->exten, exten, sizeof(c->exten)-1);
                                c->priority = priority;
                                pbx_substitute_variables(passdata, sizeof(passdata), c, e);
                                if (option_debug)
index b9a680d..7dd8857 100755 (executable)
@@ -496,7 +496,7 @@ static int moh_register(char *classname, char *mode, char *param, char *miscargs
        if (!strcasecmp(mode, "mp3") || !strcasecmp(mode, "quietmp3") || !strcasecmp(mode, "httpmp3")) {
                if (!strcasecmp(mode, "quietmp3"))
                        moh->quiet = 1;
-               strncpy(moh->dir, param, sizeof(moh->dir));
+               strncpy(moh->dir, param, sizeof(moh->dir) - 1);
                moh->srcfd = -1;
 #ifdef ZAPATA_MOH
                /* It's an MP3 Moh -- Open /dev/zap/pseudo for timing...  Is