diff options
author | Corey Farrell <git@cfware.com> | 2014-02-01 00:25:54 +0000 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2014-02-01 00:25:54 +0000 |
commit | ccf8b48f14ffdf535de465c7b1d8e2dc7779fc00 (patch) | |
tree | 3af8379fe584f5e0c39c1a5f28b46d85696d87d3 /apps/app_stack.c | |
parent | 66c46fba24ccfa782339e3ef2722ea53b5573d17 (diff) |
app_stack: protect against missing parameters to STACK_PEEK and LOCAL_PEEK
STACK_PEEK requires 2 parameters and LOCAL_PEEK requires 1 parameter. This
protects against situations where those parameters are blank or missing by
logging an error and returning.
(closes issue ASTERISK-23220)
Reported by: James Sharp
........
Merged revisions 407100 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 407103 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 407104 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_stack.c')
-rw-r--r-- | apps/app_stack.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/app_stack.c b/apps/app_stack.c index 2199b3369..db335c507 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -784,6 +784,12 @@ static int peek_read(struct ast_channel *chan, const char *cmd, char *data, char } AST_STANDARD_RAW_ARGS(args, data); + + if (ast_strlen_zero(args.n) || ast_strlen_zero(args.name)) { + ast_log(LOG_ERROR, "LOCAL_PEEK requires parameters n and varname\n"); + return -1; + } + n = atoi(args.n); *buf = '\0'; @@ -823,6 +829,11 @@ static int stackpeek_read(struct ast_channel *chan, const char *cmd, char *data, data = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, data); + if (ast_strlen_zero(args.n) || ast_strlen_zero(args.which)) { + ast_log(LOG_ERROR, "STACK_PEEK requires parameters n and which\n"); + return -1; + } + n = atoi(args.n); if (n <= 0) { ast_log(LOG_ERROR, "STACK_PEEK must be called with a positive peek value\n"); |