]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Do not crash if we are not passed in a followme id.
authorJoshua Colp <jcolp@digium.com>
Thu, 18 Dec 2008 16:07:37 +0000 (16:07 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 18 Dec 2008 16:07:37 +0000 (16:07 +0000)
(closes issue #14106)
Reported by: ys
Patches:
      app_followme.c.2.diff uploaded by ys (license 281)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@165537 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_followme.c

index fca6facc2e7f35e117ad5195243d290cec89eb0e..b5bb5588cabcff492d15a61246194000021843bd 100644 (file)
@@ -960,22 +960,26 @@ static int app_exec(struct ast_channel *chan, void *data)
                AST_APP_ARG(options);
        );
        
+       if (ast_strlen_zero(data)) {
+               ast_log(LOG_WARNING, "%s requires an argument (followmeid)\n",app);
+               return -1;
+       }
+
        if (!(argstr = ast_strdupa((char *)data))) {
                ast_log(LOG_ERROR, "Out of memory!\n");
                return -1;
        }
 
-       if (!data) {
-               ast_log(LOG_WARNING, "%s requires an argument (followmeid)\n",app);
+
+       AST_STANDARD_APP_ARGS(args, argstr);
+       if (ast_strlen_zero(args.followmeid)) {
+               ast_log(LOG_WARNING, "%s requires an argument (followmeid)\n", app);
                return -1;
        }
 
        u = ast_module_user_add(chan);
 
-       AST_STANDARD_APP_ARGS(args, argstr);
-
-       if (!ast_strlen_zero(args.followmeid)) 
-               AST_LIST_LOCK(&followmes);
+       AST_LIST_LOCK(&followmes);
        AST_LIST_TRAVERSE(&followmes, f, entry) {
                if (!strcasecmp(f->name, args.followmeid) && (f->active))
                        break;