Skip to content
Snippets Groups Projects
Commit 3e94a992 authored by Corey Farrell's avatar Corey Farrell
Browse files

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@407103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 2bbbf856
Branches
Tags
No related merge requests found
...@@ -763,6 +763,12 @@ static int peek_read(struct ast_channel *chan, const char *cmd, char *data, char ...@@ -763,6 +763,12 @@ static int peek_read(struct ast_channel *chan, const char *cmd, char *data, char
} }
AST_STANDARD_RAW_ARGS(args, data); 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); n = atoi(args.n);
*buf = '\0'; *buf = '\0';
...@@ -802,6 +808,11 @@ static int stackpeek_read(struct ast_channel *chan, const char *cmd, char *data, ...@@ -802,6 +808,11 @@ static int stackpeek_read(struct ast_channel *chan, const char *cmd, char *data,
data = ast_strdupa(data); data = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, 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); n = atoi(args.n);
if (n <= 0) { if (n <= 0) {
ast_log(LOG_ERROR, "STACK_PEEK must be called with a positive peek value\n"); ast_log(LOG_ERROR, "STACK_PEEK must be called with a positive peek value\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment