From 8cae492343324ae845b8b19d78b253d824eac10f Mon Sep 17 00:00:00 2001 From: tilghman Date: Mon, 10 Aug 2009 19:15:57 +0000 Subject: AST-2009-005 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@211528 f38db490-d61c-443f-a65b-d21fe96a405b --- pbx/dundi-parser.c | 2 +- pbx/pbx_ael.c | 8 ++++---- pbx/pbx_config.c | 10 +++++----- pbx/pbx_dundi.c | 16 ++++++++-------- pbx/pbx_loopback.c | 2 +- pbx/pbx_spool.c | 10 +++++----- 6 files changed, 24 insertions(+), 24 deletions(-) (limited to 'pbx') diff --git a/pbx/dundi-parser.c b/pbx/dundi-parser.c index 14ef9e740..0f994797f 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_ael.c b/pbx/pbx_ael.c index 655d09632..d999caacc 100644 --- a/pbx/pbx_ael.c +++ b/pbx/pbx_ael.c @@ -877,12 +877,12 @@ static void check_timerange(pval *p) p->filename, p->startline, p->endline, p->u1.str); warns++; } - if (sscanf(times, "%d:%d", &s1, &s2) != 2) { + if (sscanf(times, "%2d:%2d", &s1, &s2) != 2) { ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The start time (%s) isn't quite right!\n", p->filename, p->startline, p->endline, times); warns++; } - if (sscanf(e, "%d:%d", &e1, &e2) != 2) { + if (sscanf(e, "%2d:%2d", &e1, &e2) != 2) { ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The end time (%s) isn't quite right!\n", p->filename, p->startline, p->endline, times); warns++; @@ -974,7 +974,7 @@ static void check_day(pval *DAY) c++; } /* Find the start */ - if (sscanf(day, "%d", &s) != 1) { + if (sscanf(day, "%2d", &s) != 1) { ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The start day of month (%s) must be a number!\n", DAY->filename, DAY->startline, DAY->endline, day); warns++; @@ -986,7 +986,7 @@ static void check_day(pval *DAY) } s--; if (c) { - if (sscanf(c, "%d", &e) != 1) { + if (sscanf(c, "%2d", &e) != 1) { ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: The end day of month (%s) must be a number!\n", DAY->filename, DAY->startline, DAY->endline, c); warns++; diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index c16d22c9b..fd79cc48d 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -1423,7 +1423,7 @@ static int handle_context_add_extension_deprecated(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; } @@ -1516,7 +1516,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; } @@ -2248,7 +2248,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; @@ -2395,9 +2395,9 @@ static void pbx_load_users(void) c = zapcopy; 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 8052c08fc..412e24e9a 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -1145,7 +1145,7 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke if (expiration > 0) { ast_log(LOG_DEBUG, "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) { @@ -4043,7 +4043,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; @@ -4141,7 +4141,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; @@ -4238,7 +4238,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; @@ -4473,14 +4473,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 @@ -4496,7 +4496,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; @@ -4533,7 +4533,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 042cbfb5f..d9a3e737b 100644 --- a/pbx/pbx_loopback.c +++ b/pbx/pbx_loopback.c @@ -129,7 +129,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 3ab4e8385..30c430b69 100644 --- a/pbx/pbx_spool.c +++ b/pbx/pbx_spool.c @@ -190,7 +190,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; } @@ -201,24 +201,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; } -- cgit v1.2.3