aboutsummaryrefslogtreecommitdiffstats
path: root/pbx
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-10 19:25:03 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-10 19:25:03 +0000
commitdbef80dfa2752f6306e45af841d5573ccfd14f03 (patch)
tree638d77074098ba848a915b044a9c6b4d12efb4ca /pbx
parent55ecd87dff70a3ca8ff715adae8d95b68c238e26 (diff)
AST-2009-005
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@211551 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r--pbx/dundi-parser.c6
-rw-r--r--pbx/pbx_config.c8
-rw-r--r--pbx/pbx_dundi.c18
-rw-r--r--pbx/pbx_loopback.c2
-rw-r--r--pbx/pbx_spool.c10
5 files changed, 22 insertions, 22 deletions
diff --git a/pbx/dundi-parser.c b/pbx/dundi-parser.c
index 0195e3adc..cdb2dc7a2 100644
--- a/pbx/dundi-parser.c
+++ b/pbx/dundi-parser.c
@@ -85,9 +85,9 @@ int dundi_str_to_eid(dundi_eid *eid, const char *s)
{
unsigned int eid_int[6];
int x;
- if (sscanf(s, "%x:%x:%x:%x:%x:%x", &eid_int[0], &eid_int[1], &eid_int[2],
+ if (sscanf(s, "%2x:%2x:%2x:%2x:%2x:%2x", &eid_int[0], &eid_int[1], &eid_int[2],
&eid_int[3], &eid_int[4], &eid_int[5]) != 6)
- return -1;
+ return -1;
for (x=0;x<6;x++)
eid->eid[x] = eid_int[x];
return 0;
@@ -99,7 +99,7 @@ int dundi_str_short_to_eid(dundi_eid *eid, const char *s)
int x;
if (sscanf(s, "%2x%2x%2x%2x%2x%2x", &eid_int[0], &eid_int[1], &eid_int[2],
&eid_int[3], &eid_int[4], &eid_int[5]) != 6)
- return -1;
+ return -1;
for (x = 0; x < 6; x++)
eid->eid[x] = eid_int[x];
return 0;
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 23dc96e70..e55dcf51f 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -942,7 +942,7 @@ static char *handle_cli_dialplan_add_extension(struct ast_cli_entry *e, int cmd,
if (!strcmp(prior, "hint")) {
iprior = PRIORITY_HINT;
} else {
- if (sscanf(prior, "%d", &iprior) != 1) {
+ if (sscanf(prior, "%30d", &iprior) != 1) {
ast_cli(a->fd, "'%s' is not a valid priority\n", prior);
prior = NULL;
}
@@ -1421,7 +1421,7 @@ static int pbx_load_config(const char *config_file)
ipri = lastpri;
else
ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry!\n");
- } else if (sscanf(pri, "%d", &ipri) != 1 &&
+ } else if (sscanf(pri, "%30d", &ipri) != 1 &&
(ipri = ast_findlabel_extension2(NULL, con, realext, pri, cidmatch)) < 1) {
ast_log(LOG_WARNING, "Invalid priority/label '%s' at line %d\n", pri, v->lineno);
ipri = 0;
@@ -1548,9 +1548,9 @@ static void pbx_load_users(void)
c = dahdicopy;
chan = strsep(&c, ",");
while (chan) {
- if (sscanf(chan, "%d-%d", &start, &finish) == 2) {
+ if (sscanf(chan, "%30d-%30d", &start, &finish) == 2) {
/* Range */
- } else if (sscanf(chan, "%d", &start)) {
+ } else if (sscanf(chan, "%30d", &start)) {
/* Just one */
finish = start;
} else {
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index 336ab9f7c..d8014a283 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -519,7 +519,7 @@ static int get_mapping_weight(struct dundi_mapping *map)
buf[0] = 0;
if (map->weightstr) {
pbx_substitute_variables_helper(NULL, map->weightstr, buf, sizeof(buf) - 1);
- if (sscanf(buf, "%d", &map->_weight) != 1)
+ if (sscanf(buf, "%30d", &map->_weight) != 1)
map->_weight = MAX_WEIGHT;
}
@@ -1132,7 +1132,7 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke
if (expiration > 0) {
ast_debug(1, "Found cache expiring in %d seconds!\n", expiration);
ptr += length + 1;
- while((sscanf(ptr, "%d/%d/%d/%n", &(flags.flags), &weight, &tech, &length) == 3)) {
+ while((sscanf(ptr, "%30d/%30d/%30d/%n", &(flags.flags), &weight, &tech, &length) == 3)) {
ptr += length;
term = strchr(ptr, '|');
if (term) {
@@ -4132,7 +4132,7 @@ static int dundi_result_read(struct ast_channel *chan, const char *cmd, char *da
goto finish;
}
- if (sscanf(args.resultnum, "%u", &num) != 1) {
+ if (sscanf(args.resultnum, "%30u", &num) != 1) {
ast_log(LOG_ERROR, "Invalid value '%s' for resultnum to DUNDIRESULT!\n",
args.resultnum);
goto finish;
@@ -4296,7 +4296,7 @@ static void build_mapping(const char *name, const char *value)
} else if (x >= 4) {
ast_copy_string(map->dcontext, name, sizeof(map->dcontext));
ast_copy_string(map->lcontext, fields[0], sizeof(map->lcontext));
- if ((sscanf(fields[1], "%d", &map->_weight) == 1) && (map->_weight >= 0) && (map->_weight <= MAX_WEIGHT)) {
+ if ((sscanf(fields[1], "%30d", &map->_weight) == 1) && (map->_weight >= 0) && (map->_weight <= MAX_WEIGHT)) {
ast_copy_string(map->dest, fields[3], sizeof(map->dest));
if ((map->tech = str2tech(fields[2])))
map->dead = 0;
@@ -4398,7 +4398,7 @@ static void populate_addr(struct dundi_peer *peer, dundi_eid *eid)
if (c) {
*c = '\0';
c++;
- if (sscanf(c, "%d:%d", &port, &expire) == 2) {
+ if (sscanf(c, "%5d:%30d", &port, &expire) == 2) {
/* Got it! */
inet_aton(data, &peer->addr.sin_addr);
peer->addr.sin_family = AF_INET;
@@ -4495,7 +4495,7 @@ static void build_peer(dundi_eid *eid, struct ast_variable *v, int *globalpcmode
peer->maxms = 0;
} else if (!strcasecmp(v->value, "yes")) {
peer->maxms = DEFAULT_MAXMS;
- } else if (sscanf(v->value, "%d", &peer->maxms) != 1) {
+ } else if (sscanf(v->value, "%30d", &peer->maxms) != 1) {
ast_log(LOG_WARNING, "Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of dundi.conf\n",
dundi_eid_to_str(eid_str, sizeof(eid_str), &peer->eid), v->lineno);
peer->maxms = 0;
@@ -4732,14 +4732,14 @@ static int set_config(char *config_file, struct sockaddr_in* sin, int reload)
} else if (!strcasecmp(v->name, "authdebug")) {
authdebug = ast_true(v->value);
} else if (!strcasecmp(v->name, "ttl")) {
- if ((sscanf(v->value, "%d", &x) == 1) && (x > 0) && (x < DUNDI_DEFAULT_TTL)) {
+ if ((sscanf(v->value, "%30d", &x) == 1) && (x > 0) && (x < DUNDI_DEFAULT_TTL)) {
dundi_ttl = x;
} else {
ast_log(LOG_WARNING, "'%s' is not a valid TTL at line %d, must be number from 1 to %d\n",
v->value, v->lineno, DUNDI_DEFAULT_TTL);
}
} else if (!strcasecmp(v->name, "autokill")) {
- if (sscanf(v->value, "%d", &x) == 1) {
+ if (sscanf(v->value, "%30d", &x) == 1) {
if (x >= 0)
global_autokilltimeout = x;
else
@@ -4774,7 +4774,7 @@ static int set_config(char *config_file, struct sockaddr_in* sin, int reload)
} else if (!strcasecmp(v->name, "storehistory")) {
global_storehistory = ast_true(v->value);
} else if (!strcasecmp(v->name, "cachetime")) {
- if ((sscanf(v->value, "%d", &x) == 1)) {
+ if ((sscanf(v->value, "%30d", &x) == 1)) {
dundi_cache_time = x;
} else {
ast_log(LOG_WARNING, "'%s' is not a valid cache time at line %d. Using default value '%d'.\n",
diff --git a/pbx/pbx_loopback.c b/pbx/pbx_loopback.c
index e9001deef..f51ec8204 100644
--- a/pbx/pbx_loopback.c
+++ b/pbx/pbx_loopback.c
@@ -120,7 +120,7 @@ static void loopback_parse(char **newexten, char **newcontext, int *priority, ch
if (!ast_strlen_zero(con))
*newcontext = con;
if (!ast_strlen_zero(pri))
- sscanf(pri, "%d", priority);
+ sscanf(pri, "%30d", priority);
}
static int loopback_exists(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c
index 3f85c4c7b..6307a2098 100644
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -182,7 +182,7 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
} else if (!strcasecmp(buf, "data")) {
ast_copy_string(o->data, c, sizeof(o->data));
} else if (!strcasecmp(buf, "maxretries")) {
- if (sscanf(c, "%d", &o->maxretries) != 1) {
+ if (sscanf(c, "%30d", &o->maxretries) != 1) {
ast_log(LOG_WARNING, "Invalid max retries at line %d of %s\n", lineno, fn);
o->maxretries = 0;
}
@@ -193,24 +193,24 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f)
} else if (!strcasecmp(buf, "extension")) {
ast_copy_string(o->exten, c, sizeof(o->exten));
} else if (!strcasecmp(buf, "priority")) {
- if ((sscanf(c, "%d", &o->priority) != 1) || (o->priority < 1)) {
+ if ((sscanf(c, "%30d", &o->priority) != 1) || (o->priority < 1)) {
ast_log(LOG_WARNING, "Invalid priority at line %d of %s\n", lineno, fn);
o->priority = 1;
}
} else if (!strcasecmp(buf, "retrytime")) {
- if ((sscanf(c, "%d", &o->retrytime) != 1) || (o->retrytime < 1)) {
+ if ((sscanf(c, "%30d", &o->retrytime) != 1) || (o->retrytime < 1)) {
ast_log(LOG_WARNING, "Invalid retrytime at line %d of %s\n", lineno, fn);
o->retrytime = 300;
}
} else if (!strcasecmp(buf, "waittime")) {
- if ((sscanf(c, "%d", &o->waittime) != 1) || (o->waittime < 1)) {
+ if ((sscanf(c, "%30d", &o->waittime) != 1) || (o->waittime < 1)) {
ast_log(LOG_WARNING, "Invalid waittime at line %d of %s\n", lineno, fn);
o->waittime = 45;
}
} else if (!strcasecmp(buf, "retry")) {
o->retries++;
} else if (!strcasecmp(buf, "startretry")) {
- if (sscanf(c, "%ld", &o->callingpid) != 1) {
+ if (sscanf(c, "%30ld", &o->callingpid) != 1) {
ast_log(LOG_WARNING, "Unable to retrieve calling PID!\n");
o->callingpid = 0;
}