--- main/pbx_variables.orig 2021-01-10 12:02:51.220040938 +0100 +++ main/pbx_variables.c 2021-01-10 12:18:51.309314729 +0100 @@ -1126,7 +1126,8 @@ int pbx_builtin_setvar(struct ast_channel *chan, const char *data) { - char *name, *value, *mydata; + char *name, *value, *mydata, *scan; + int paren = 0, quote = 0, bracket = 0; if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "Set requires one variable name/value pair.\n"); @@ -1134,8 +1135,36 @@ } mydata = ast_strdupa(data); - name = strsep(&mydata, "="); - value = mydata; + + scan=mydata; + name=NULL; + value=NULL; + + for (; *scan; scan++) { + if (*scan == '(') { + paren++; + } else if (*scan == ')') { + if (paren) { + paren--; + } + } else if (*scan == '[') { + bracket++; + } else if (*scan == ']') { + if (bracket) { + bracket--; + } + } else if (*scan == '"') { + quote = quote ? 0 : 1; + } else if (*scan == '\\') { + scan++; + } else if ((*scan == '=') && !paren && !quote && !bracket) { + *scan++ = '\0'; + value=scan; + name=mydata; + break; + } + } + if (!value) { ast_log(LOG_WARNING, "Set requires an '=' to be a valid assignment.\n"); return 0;