diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-18 06:49:16 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-18 06:49:16 +0000 |
commit | 3507dc659a160147ff5bf748333ef2deb5a3575e (patch) | |
tree | 991adbd0b2a63d8387024c23bc0fc4f1590a960a | |
parent | 65256f0a290a1cd7832bb5379dd5b21035c80d0c (diff) |
For consistency sake, ensure that the values that ${CALLINGPRES} returns are valid as an
input to SetCallingPres. (Closes issue #12472)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@114242 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | apps/app_setcallerid.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/app_setcallerid.c b/apps/app_setcallerid.c index 4456e1ee0..fb060f11b 100644 --- a/apps/app_setcallerid.c +++ b/apps/app_setcallerid.c @@ -70,8 +70,11 @@ static int setcallerid_pres_exec(struct ast_channel *chan, void *data) int pres = -1; u = ast_module_user_add(chan); - - pres = ast_parse_caller_presentation(data); + + /* For interface consistency, permit the argument to be specified as a number */ + if (sscanf(data, "%d", &pres) != 1 || pres < 0 || pres > 255 || (pres & 0x9c)) { + pres = ast_parse_caller_presentation(data); + } if (pres < 0) { ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show application SetCallerPres')\n", |