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
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)