[asterisk-commits] res agi: Prevent crash when SET VARIABLE called without argu... (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 25 14:44:11 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/5700 )

Change subject: res_agi: Prevent crash when SET VARIABLE called without arguments
......................................................................


res_agi: Prevent crash when SET VARIABLE called without arguments

Explicitly check that the appropriate number of arguments were passed to
SET VARIABLE before attempting to reference them. Also initialize the
arguments array to zeroes before populating it.

ASTERISK-22432 #close

Change-Id: I5143607d80a2724f749c1674f3126b04ed32ea97
---
M res/res_agi.c
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Jenkins2: Approved for Submit
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_agi.c b/res/res_agi.c
index cd0d621..bbb41d8 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -3185,6 +3185,10 @@
 
 static int handle_setvariable(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
 {
+	if (argc != 4) {
+		return RESULT_SHOWUSAGE;
+	}
+
 	if (argv[3])
 		pbx_builtin_setvar_helper(chan, argv[2], argv[3]);
 
@@ -4003,7 +4007,7 @@
 
 static enum agi_result agi_handle_command(struct ast_channel *chan, AGI *agi, char *buf, int dead)
 {
-	const char *argv[MAX_ARGS];
+	const char *argv[MAX_ARGS] = {0};
 	int argc = MAX_ARGS;
 	int res;
 	agi_command *c;

-- 
To view, visit https://gerrit.asterisk.org/5700
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5143607d80a2724f749c1674f3126b04ed32ea97
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list