]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
manager: Fix appending variables.
authorNaveen Albert <asterisk@phreaknet.org>
Thu, 22 Dec 2022 01:01:01 +0000 (01:01 +0000)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Tue, 3 Jan 2023 18:02:36 +0000 (12:02 -0600)
The if statement here is always false after the for
loop finishes, so variables are never appended.
This removes that to properly append to the end
of the variable list.

ASTERISK-30351 #close
Reported by: Sebastian Gutierrez

Change-Id: I1b7f8b85a8918f6a814cb933a479d4278cf16199

main/manager.c

index 8a198b38ac9b0ba14dbd1666aaa03ae0fda89916..c5a48fd4cb16af32d611ad33bd2eac302ac9c0db 100644 (file)
@@ -6274,14 +6274,12 @@ static int action_originate(struct mansession *s, const struct message *m)
                old = vars;
                vars = NULL;
 
-               /* The variables in the AMI originate action are appended at the end of the list, to override any user variables that apply*/
+               /* The variables in the AMI originate action are appended at the end of the list, to override any user variables that apply */
 
                vars = ast_variables_dup(s->session->chanvars);
                if (old) {
                        for (v = vars; v->next; v = v->next );
-                       if (v->next) {
-                               v->next = old;  /* Append originate variables at end of list */
-                       }
+                       v->next = old;  /* Append originate variables at end of list */
                }
        }