[Asterisk-code-review] pbx_ael: Global variables are not expanded. (asterisk[20])

Sean Bright asteriskteam at digium.com
Thu Jan 26 20:28:00 CST 2023


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19838 )


Change subject: pbx_ael: Global variables are not expanded.
......................................................................

pbx_ael: Global variables are not expanded.

Variable references within global variable assignments are now
expanded rather than being included literally.

ASTERISK-30406 #close

Change-Id: I136e8d6395e90a4c92d9777a46a7bc3edb08d05d
---
M res/ael/pval.c
1 file changed, 25 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/38/19838/1

diff --git a/res/ael/pval.c b/res/ael/pval.c
index 10af159..8596d66 100644
--- a/res/ael/pval.c
+++ b/res/ael/pval.c
@@ -4414,7 +4414,11 @@
 {
 	pval *p,*p2;
 	struct ast_context *context;
+#ifdef LOW_MEMORY
 	char buf[2000];
+#else
+	char buf[8192];
+#endif
 	struct ael_extension *exten;
 	struct ael_extension *exten_list = 0;
 
@@ -4427,9 +4431,13 @@
 		case PV_GLOBALS:
 			/* just VARDEC elements */
 			for (p2=p->u1.list; p2; p2=p2->next) {
-				char buf2[2000];
-				snprintf(buf2,sizeof(buf2),"%s=%s", p2->u1.str, p2->u2.val);
-				pbx_builtin_setvar(NULL, buf2);
+#ifdef STANDALONE
+				snprintf(buf, sizeof(buf), "%s=%s", p2->u1.str, p2->u2.val);
+				pbx_builtin_setvar(NULL, buf);
+#else
+				pbx_substitute_variables_helper(NULL, p2->u2.val, buf, sizeof(buf) - 1);
+				pbx_builtin_setvar_helper(NULL, p2->u1.str, buf);
+#endif
 			}
 			break;
 		default:

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19838
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 20
Gerrit-Change-Id: I136e8d6395e90a4c92d9777a46a7bc3edb08d05d
Gerrit-Change-Number: 19838
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean at seanbright.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230127/15b8f22f/attachment.html>


More information about the asterisk-code-review mailing list