diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-10 19:12:35 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-10 19:12:35 +0000 |
commit | 248d8c804f87e0405ec66454fe7e0e30db14bb8d (patch) | |
tree | 872527e87b8284baaa5d1ab1d447a5551fac6cb0 /pbx | |
parent | 6684417af1a95717df6f035c0eb6d4242c2d799a (diff) |
AST-2009-005
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@211526 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r-- | pbx/dundi-parser.c | 2 | ||||
-rw-r--r-- | pbx/pbx_config.c | 4 | ||||
-rw-r--r-- | pbx/pbx_dundi.c | 20 | ||||
-rw-r--r-- | pbx/pbx_loopback.c | 2 | ||||
-rw-r--r-- | pbx/pbx_spool.c | 10 |
5 files changed, 19 insertions, 19 deletions
diff --git a/pbx/dundi-parser.c b/pbx/dundi-parser.c index 9b9d9d205..9ff70f952 100644 --- a/pbx/dundi-parser.c +++ b/pbx/dundi-parser.c @@ -91,7 +91,7 @@ int dundi_str_to_eid(dundi_eid *eid, 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; for (x=0;x<6;x++) diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index 5e850a2bf..5151ea0e3 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1192,7 +1192,7 @@ static int handle_context_add_extension(int fd, int argc, char *argv[]) if (!strcmp(prior, "hint")) { iprior = PRIORITY_HINT; } else { - if (sscanf(prior, "%d", &iprior) != 1) { + if (sscanf(prior, "%30d", &iprior) != 1) { ast_cli(fd, "'%s' is not a valid priority\n", prior); prior = NULL; } @@ -1708,7 +1708,7 @@ static int pbx_load_module(void) else ast_log(LOG_WARNING, "Can't use 'same' priority on the first entry!\n"); } else { - if (sscanf(pri, "%d", &ipri) != 1) { + if (sscanf(pri, "%30d", &ipri) != 1) { if ((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; diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 8b87c8ec9..15792e3c6 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -1155,12 +1155,12 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke /* Build request string */ if (!ast_db_get("dundi/cache", key, data, sizeof(data))) { ptr = data; - if (sscanf(ptr, "%d|%n", (int *)&timeout, &length) == 1) { + if (sscanf(ptr, "%30d|%n", (int *)&timeout, &length) == 1) { expiration = timeout - now; if (expiration > 0) { ast_log(LOG_DEBUG, "Found cache expiring in %d seconds!\n", (int)(timeout - now)); ptr += length; - 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) { @@ -2050,7 +2050,7 @@ static void load_password(void) time_t expired; ast_db_get(secretpath, "secretexpiry", tmp, sizeof(tmp)); - if (sscanf(tmp, "%d", (int *)&expired) == 1) { + if (sscanf(tmp, "%30d", (int *)&expired) == 1) { ast_db_get(secretpath, "secret", tmp, sizeof(tmp)); current = strchr(tmp, ';'); if (!current) @@ -4169,7 +4169,7 @@ static void build_mapping(char *name, 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 < 60000)) { + if ((sscanf(fields[1], "%30d", &map->weight) == 1) && (map->weight >= 0) && (map->weight < 60000)) { ast_copy_string(map->dest, fields[3], sizeof(map->dest)); if ((map->tech = str2tech(fields[2]))) { map->dead = 0; @@ -4272,7 +4272,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, "%30d:%30d", &port, &expire) == 2) { /* Got it! */ inet_aton(data, &peer->addr.sin_addr); peer->addr.sin_family = AF_INET; @@ -4377,7 +4377,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; @@ -4613,14 +4613,14 @@ static int set_config(char *config_file, struct sockaddr_in* sin) } 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 @@ -4636,7 +4636,7 @@ static int set_config(char *config_file, struct sockaddr_in* sin) else ast_log(LOG_WARNING, "Invalid global endpoint identifier '%s' at line %d\n", v->value, v->lineno); } else if (!strcasecmp(v->name, "tos")) { - if (sscanf(v->value, "%d", &format) == 1) + if (sscanf(v->value, "%30d", &format) == 1) tos = format & 0xff; else if (!strcasecmp(v->value, "lowdelay")) tos = IPTOS_LOWDELAY; @@ -4673,7 +4673,7 @@ static int set_config(char *config_file, struct sockaddr_in* sin) } 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 5522e9b09..ec7199506 100644 --- a/pbx/pbx_loopback.c +++ b/pbx/pbx_loopback.c @@ -126,7 +126,7 @@ static void loopback_subst(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 1141b85a1..15e0222a8 100644 --- a/pbx/pbx_spool.c +++ b/pbx/pbx_spool.c @@ -168,7 +168,7 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f) } else if (!strcasecmp(buf, "data")) { strncpy(o->data, c, sizeof(o->data) - 1); } 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; } @@ -177,24 +177,24 @@ static int apply_outgoing(struct outgoing *o, char *fn, FILE *f) } else if (!strcasecmp(buf, "extension")) { strncpy(o->exten, c, sizeof(o->exten) - 1); } 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 retrytime 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, "%d", &o->callingpid) != 1) { + if (sscanf(c, "%30d", &o->callingpid) != 1) { ast_log(LOG_WARNING, "Unable to retrieve calling PID!\n"); o->callingpid = 0; } |