Fix pbx_builtin_setlanguage to not seg when data is a NULL ptr. Also fix AGI so...
authorJames Golovich <james@gnuinter.net>
Wed, 13 Oct 2004 22:47:42 +0000 (22:47 +0000)
committerJames Golovich <james@gnuinter.net>
Wed, 13 Oct 2004 22:47:42 +0000 (22:47 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3990 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx.c
res/res_agi.c

diff --git a/pbx.c b/pbx.c
index 4010411..26a3e02 100755 (executable)
--- a/pbx.c
+++ b/pbx.c
@@ -4483,7 +4483,8 @@ static int pbx_builtin_answer(struct ast_channel *chan, void *data)
 static int pbx_builtin_setlanguage(struct ast_channel *chan, void *data)
 {
        /* Copy the language as specified */
-       strncpy(chan->language, (char *)data, sizeof(chan->language)-1);
+       if (data)
+               strncpy(chan->language, (char *)data, sizeof(chan->language)-1);
        return 0;
 }
 
index b6f6ede..69133e7 100755 (executable)
@@ -827,7 +827,7 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv
        app = pbx_findapp(argv[1]);
 
        if (app) {
-               res = pbx_exec(chan, app, argv[2], 1);
+               res = pbx_exec(chan, app, argv[2] ? argv[2] : NULL, 1);
        } else {
                ast_log(LOG_WARNING, "Could not find application (%s)\n", argv[1]);
                res = -2;