ast_control_streamfile caused seg with null stop or pause chars
authorAnthony Minessale II <anthmct@yahoo.com>
Thu, 23 Sep 2004 14:46:09 +0000 (14:46 +0000)
committerAnthony Minessale II <anthmct@yahoo.com>
Thu, 23 Sep 2004 14:46:09 +0000 (14:46 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3823 65c4cc65-6c06-0410-ace0-fbb531ad65f3

app.c

diff --git a/app.c b/app.c
index 29f446f..eb1a37e 100755 (executable)
--- a/app.c
+++ b/app.c
@@ -415,7 +415,7 @@ int ast_control_streamfile(struct ast_channel *chan, char *file, char *fwd, char
 {
        struct timeval started, ended;
        long elapsed = 0,last_elapsed =0;
-       char *breaks;
+       char *breaks=NULL;
        int blen=2;
        int res=0;
 
@@ -424,11 +424,12 @@ int ast_control_streamfile(struct ast_channel *chan, char *file, char *fwd, char
        if (pause)
                blen += strlen(pause);
 
-       breaks = alloca(blen + 1);
-       breaks[0] = '\0';
-       strcat(breaks, stop);
-       strcat(breaks, pause);
-
+       if(blen > 2) {
+               breaks = alloca(blen + 1);
+               breaks[0] = '\0';
+               strcat(breaks, stop);
+               strcat(breaks, pause);
+       }
        if (chan->_state != AST_STATE_UP)
                res = ast_answer(chan);