From 6ec5c103d6b09721dff771679f0ca98526b4698b Mon Sep 17 00:00:00 2001 From: Russell Bryant <russell@russellbryant.com> Date: Wed, 14 Mar 2012 00:01:40 +0000 Subject: [PATCH] Don't use a buffer after it goes out of scope. 's' is set to 'workspace'. Make sure 'workspace' doesn't go out of scope while the reference to it via 's' is still used. ........ Merged revisions 359056 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 359057 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359058 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/pbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/pbx.c b/main/pbx.c index 221e5173f8..905310ccf3 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -3257,6 +3257,7 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru int offset, length; int i, need_substring; struct varshead *places[2] = { headp, &globals }; /* list of places where we may look */ + char workspace[20]; if (c) { ast_channel_lock(c); @@ -3352,7 +3353,6 @@ const char *ast_str_retrieve_variable(struct ast_str **str, ssize_t maxlen, stru } else if (!strcmp(var, "ASTLOGDIR")) { s = ast_config_AST_LOG_DIR; } else if (!strcmp(var, "ENTITYID")) { - char workspace[20]; ast_eid_to_str(workspace, sizeof(workspace), &ast_eid_default); s = workspace; } -- GitLab