From: Tilghman Lesher Date: Wed, 23 Dec 2009 03:10:21 +0000 (+0000) Subject: Merged revisions 236186 via svnmerge from X-Git-Tag: 1.6.1.13-rc1~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06e7edc52516b7e4d67cfac2059541c4664552fc;p=thirdparty%2Fasterisk.git Merged revisions 236186 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r236186 | tilghman | 2009-12-22 21:07:48 -0600 (Tue, 22 Dec 2009) | 11 lines Merged revisions 236184 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r236184 | tilghman | 2009-12-22 20:55:24 -0600 (Tue, 22 Dec 2009) | 4 lines If EXEC only gets a single argument, don't crash when the second is used. (closes issue #16504) Reported by: bklang ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@236188 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_agi.c b/res/res_agi.c index d953a9d2ff..c81ddf9b74 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -1473,7 +1473,7 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv } if (ast_compat_res_agi && !ast_strlen_zero(argv[2])) { char *compat = alloca(strlen(argv[2]) * 2 + 1), *cptr, *vptr; - for (cptr = compat, vptr = argv[2]; *vptr; vptr++) { + for (cptr = compat, vptr = (argc == 2) ? "" : argv[2]; *vptr; vptr++) { if (*vptr == ',') { *cptr++ = '\\'; *cptr++ = ','; @@ -1486,7 +1486,7 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv *cptr = '\0'; res = pbx_exec(chan, app_to_exec, compat); } else { - res = pbx_exec(chan, app_to_exec, argv[2]); + res = pbx_exec(chan, app_to_exec, argc == 2 ? "" : argv[2]); } } else { ast_log(LOG_WARNING, "Could not find application (%s)\n", argv[1]);