]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 290712 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Thu, 7 Oct 2010 11:00:52 +0000 (11:00 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 7 Oct 2010 11:00:52 +0000 (11:00 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

........
  r290712 | russell | 2010-10-07 12:53:56 +0200 (Thu, 07 Oct 2010) | 4 lines

  Don't crash when Set() is called without a value.

  Review: https://reviewboard.asterisk.org/r/949/
........

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

main/pbx.c

index 9b44306bf635eac609012e3335a3d6470e485f19..87ebdd854ad2f71d933d52e32b408fc3b9275899 100644 (file)
@@ -9550,11 +9550,18 @@ int pbx_builtin_setvar(struct ast_channel *chan, const char *data)
        mydata = ast_strdupa(data);
        name = strsep(&mydata, "=");
        value = mydata;
-       if (strchr(name, ' '))
+       if (!value) {
+               ast_log(LOG_WARNING, "Set requires an '=' to be a valid assignment.\n");
+               return 0;
+       }
+
+       if (strchr(name, ' ')) {
                ast_log(LOG_WARNING, "Please avoid unnecessary spaces on variables as it may lead to unexpected results ('%s' set to '%s').\n", name, mydata);
+       }
 
        pbx_builtin_setvar_helper(chan, name, value);
-       return(0);
+
+       return 0;
 }
 
 int pbx_builtin_setvar_multiple(struct ast_channel *chan, const char *vdata)