From dbef80dfa2752f6306e45af841d5573ccfd14f03 Mon Sep 17 00:00:00 2001 From: tilghman Date: Mon, 10 Aug 2009 19:25:03 +0000 Subject: AST-2009-005 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@211551 f38db490-d61c-443f-a65b-d21fe96a405b --- res/ael/pval.c | 8 ++++---- res/res_agi.c | 24 ++++++++++++------------ res/res_config_curl.c | 6 +++--- res/res_config_ldap.c | 4 ++-- res/res_limit.c | 2 +- res/res_musiconhold.c | 2 +- res/res_odbc.c | 8 ++++---- res/res_smdi.c | 8 ++++---- res/snmp/agent.c | 2 +- 9 files changed, 32 insertions(+), 32 deletions(-) (limited to 'res') diff --git a/res/ael/pval.c b/res/ael/pval.c index 606866d3f..a5cae099e 100644 --- a/res/ael/pval.c +++ b/res/ael/pval.c @@ -859,12 +859,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++; @@ -956,7 +956,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++; @@ -968,7 +968,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/res/res_agi.c b/res/res_agi.c index c036cc5be..59fafeeac 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -818,7 +818,7 @@ static int handle_waitfordigit(struct ast_channel *chan, AGI *agi, int argc, cha if (argc != 4) return RESULT_SHOWUSAGE; - if (sscanf(argv[3], "%d", &to) != 1) + if (sscanf(argv[3], "%30d", &to) != 1) return RESULT_SHOWUSAGE; res = ast_waitfordigit_full(chan, to, agi->audio, agi->ctrl); ast_agi_send(agi->fd, chan, "200 result=%d\n", res); @@ -931,7 +931,7 @@ static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc else stop = NULL; - if ((argc > 5) && (sscanf(argv[5], "%d", &skipms) != 1)) + if ((argc > 5) && (sscanf(argv[5], "%30d", &skipms) != 1)) return RESULT_SHOWUSAGE; if (argc > 6 && !ast_strlen_zero(argv[6])) @@ -969,7 +969,7 @@ static int handle_streamfile(struct ast_channel *chan, AGI *agi, int argc, char if (argv[3]) edigits = argv[3]; - if ((argc > 4) && (sscanf(argv[4], "%ld", &sample_offset) != 1)) + if ((argc > 4) && (sscanf(argv[4], "%30ld", &sample_offset) != 1)) return RESULT_SHOWUSAGE; if (!(fs = ast_openstream(chan, argv[2], chan->language))) { @@ -1081,7 +1081,7 @@ static int handle_saynumber(struct ast_channel *chan, AGI *agi, int argc, char * if (argc < 4 || argc > 5) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &num) != 1) + if (sscanf(argv[2], "%30d", &num) != 1) return RESULT_SHOWUSAGE; res = ast_say_number_full(chan, num, argv[3], chan->language, argc > 4 ? argv[4] : NULL, agi->audio, agi->ctrl); if (res == 1) @@ -1096,7 +1096,7 @@ static int handle_saydigits(struct ast_channel *chan, AGI *agi, int argc, char * if (argc != 4) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &num) != 1) + if (sscanf(argv[2], "%30d", &num) != 1) return RESULT_SHOWUSAGE; res = ast_say_digit_str_full(chan, argv[2], argv[3], chan->language, agi->audio, agi->ctrl); @@ -1126,7 +1126,7 @@ static int handle_saydate(struct ast_channel *chan, AGI *agi, int argc, char *ar if (argc != 4) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &num) != 1) + if (sscanf(argv[2], "%30d", &num) != 1) return RESULT_SHOWUSAGE; res = ast_say_date(chan, num, argv[3], chan->language); if (res == 1) @@ -1141,7 +1141,7 @@ static int handle_saytime(struct ast_channel *chan, AGI *agi, int argc, char *ar if (argc != 4) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &num) != 1) + if (sscanf(argv[2], "%30d", &num) != 1) return RESULT_SHOWUSAGE; res = ast_say_time(chan, num, argv[3], chan->language); if (res == 1) @@ -1251,7 +1251,7 @@ static int handle_setpriority(struct ast_channel *chan, AGI *agi, int argc, char if (argc != 3) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &pri) != 1) { + if (sscanf(argv[2], "%30d", &pri) != 1) { if ((pri = ast_findlabel_extension(chan, chan->context, chan->exten, argv[2], chan->cid.cid_num)) < 1) return RESULT_SHOWUSAGE; } @@ -1283,7 +1283,7 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char if (argc < 6) return RESULT_SHOWUSAGE; - if (sscanf(argv[5], "%d", &ms) != 1) + if (sscanf(argv[5], "%30d", &ms) != 1) return RESULT_SHOWUSAGE; if (argc > 6) @@ -1324,7 +1324,7 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char /* backward compatibility, if no offset given, arg[6] would have been * caught below and taken to be a beep, else if it is a digit then it is a * offset */ - if ((argc >6) && (sscanf(argv[6], "%ld", &sample_offset) != 1) && (!strchr(argv[6], '='))) + if ((argc >6) && (sscanf(argv[6], "%30ld", &sample_offset) != 1) && (!strchr(argv[6], '='))) res = ast_streamfile(chan, "beep", chan->language); if ((argc > 7) && (!strchr(argv[7], '='))) @@ -1444,7 +1444,7 @@ static int handle_autohangup(struct ast_channel *chan, AGI *agi, int argc, char if (argc != 3) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &timeout) != 1) + if (sscanf(argv[2], "%30d", &timeout) != 1) return RESULT_SHOWUSAGE; if (timeout < 0) timeout = 0; @@ -1628,7 +1628,7 @@ static int handle_verbose(struct ast_channel *chan, AGI *agi, int argc, char **a return RESULT_SHOWUSAGE; if (argv[2]) - sscanf(argv[2], "%d", &level); + sscanf(argv[2], "%30d", &level); ast_verb(level, "%s: %s\n", chan->data, argv[1]); diff --git a/res/res_config_curl.c b/res/res_config_curl.c index f36a5f6a9..ed561d62b 100644 --- a/res/res_config_curl.c +++ b/res/res_config_curl.c @@ -264,7 +264,7 @@ static int update_curl(const char *url, const char *unused, const char *keyfield stringp = buffer; while (*stringp <= ' ') stringp++; - sscanf(stringp, "%d", &rowcount); + sscanf(stringp, "%30d", &rowcount); ast_free(buffer); ast_free(query); @@ -327,7 +327,7 @@ static int store_curl(const char *url, const char *unused, va_list ap) stringp = buffer; while (*stringp <= ' ') stringp++; - sscanf(stringp, "%d", &rowcount); + sscanf(stringp, "%30d", &rowcount); ast_free(buffer); ast_free(query); @@ -395,7 +395,7 @@ static int destroy_curl(const char *url, const char *unused, const char *keyfiel stringp = buffer; while (*stringp <= ' ') stringp++; - sscanf(stringp, "%d", &rowcount); + sscanf(stringp, "%30d", &rowcount); ast_free(buffer); ast_free(query); diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c index d6f9668fe..69548a1be 100644 --- a/res/res_config_ldap.c +++ b/res/res_config_ldap.c @@ -1408,7 +1408,7 @@ int parse_config(void) if ((s = ast_variable_retrieve(config, "_general", "url"))) { ast_copy_string(url, s, sizeof(url)); } else if ((host = ast_variable_retrieve(config, "_general", "host"))) { - if (!(s = ast_variable_retrieve(config, "_general", "port")) || sscanf(s, "%d", &port) != 1) { + if (!(s = ast_variable_retrieve(config, "_general", "port")) || sscanf(s, "%5d", &port) != 1 || port > 65535) { ast_log(LOG_NOTICE, "No directory port found, using 389 as default.\n"); port = 389; } @@ -1429,7 +1429,7 @@ int parse_config(void) if (!(s = ast_variable_retrieve(config, "_general", "version")) && !(s = ast_variable_retrieve(config, "_general", "protocol"))) { ast_log(LOG_NOTICE, "No explicit LDAP version found, using 3 as default.\n"); version = 3; - } else if (sscanf(s, "%d", &version) != 1 || version < 1 || version > 6) { + } else if (sscanf(s, "%30d", &version) != 1 || version < 1 || version > 6) { ast_log(LOG_WARNING, "Invalid LDAP version '%s', using 3 as default.\n", s); version = 3; } diff --git a/res/res_limit.c b/res/res_limit.c index b1cf025b0..94a6e8719 100644 --- a/res/res_limit.c +++ b/res/res_limit.c @@ -178,7 +178,7 @@ static char *handle_cli_ulimit(struct ast_cli_entry *e, int cmd, struct ast_cli_ return CLI_FAILURE; } - sscanf(a->argv[2], "%d", &x); + sscanf(a->argv[2], "%30d", &x); rlimit.rlim_max = rlimit.rlim_cur = x; setrlimit(resource, &rlimit); return CLI_SUCCESS; diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index b83180f87..c0076209a 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -649,7 +649,7 @@ static int play_moh_exec(struct ast_channel *chan, void *data) AST_STANDARD_APP_ARGS(args, parse); if (!ast_strlen_zero(args.duration)) { - if (sscanf(args.duration, "%d", &timeout) == 1) { + if (sscanf(args.duration, "%30d", &timeout) == 1) { timeout *= 1000; } else { ast_log(LOG_WARNING, "Invalid MusicOnHold duration '%s'. Will wait indefinitely.\n", args.duration); diff --git a/res/res_odbc.c b/res/res_odbc.c index 070d0eb6a..b0c87ea7e 100644 --- a/res/res_odbc.c +++ b/res/res_odbc.c @@ -267,7 +267,7 @@ static int load_odbc_config(void) if (ast_false(v->value)) pooling = 1; } else if (!strcasecmp(v->name, "limit")) { - sscanf(v->value, "%d", &limit); + sscanf(v->value, "%30d", &limit); if (ast_true(v->value) && !limit) { ast_log(LOG_WARNING, "Limit should be a number, not a boolean: '%s'. Setting limit to 1023 for ODBC class '%s'.\n", v->value, cat); limit = 1023; @@ -277,7 +277,7 @@ static int load_odbc_config(void) break; } } else if (!strcasecmp(v->name, "idlecheck")) { - sscanf(v->value, "%d", &idlecheck); + sscanf(v->value, "%30u", &idlecheck); } else if (!strcasecmp(v->name, "enabled")) { enabled = ast_true(v->value); } else if (!strcasecmp(v->name, "pre-connect")) { @@ -659,7 +659,7 @@ static int reload(void) if (ast_false(v->value)) pooling = 1; } else if (!strcasecmp(v->name, "limit")) { - sscanf(v->value, "%d", &limit); + sscanf(v->value, "%30d", &limit); if (ast_true(v->value) && !limit) { ast_log(LOG_WARNING, "Limit should be a number, not a boolean: '%s'. Setting limit to 1023 for ODBC class '%s'.\n", v->value, cat); limit = 1023; @@ -669,7 +669,7 @@ static int reload(void) break; } } else if (!strcasecmp(v->name, "idlecheck")) { - sscanf(v->value, "%ud", &idlecheck); + sscanf(v->value, "%30u", &idlecheck); } else if (!strcasecmp(v->name, "enabled")) { enabled = ast_true(v->value); } else if (!strcasecmp(v->name, "pre-connect")) { diff --git a/res/res_smdi.c b/res/res_smdi.c index e29570b96..6647d74e2 100644 --- a/res/res_smdi.c +++ b/res/res_smdi.c @@ -849,7 +849,7 @@ static int smdi_load(int reload) baud_rate = B9600; } } else if (!strcasecmp(v->name, "msdstrip")) { - if (!sscanf(v->value, "%d", &msdstrip)) { + if (!sscanf(v->value, "%30d", &msdstrip)) { ast_log(LOG_NOTICE, "Invalid msdstrip value in %s (line %d), using default\n", config_file, v->lineno); msdstrip = 0; } else if (0 > msdstrip || msdstrip > 9) { @@ -857,7 +857,7 @@ static int smdi_load(int reload) msdstrip = 0; } } else if (!strcasecmp(v->name, "msgexpirytime")) { - if (!sscanf(v->value, "%ld", &msg_expiry)) { + if (!sscanf(v->value, "%30ld", &msg_expiry)) { ast_log(LOG_NOTICE, "Invalid msgexpirytime value in %s (line %d), using default\n", config_file, v->lineno); msg_expiry = SMDI_MSG_EXPIRY_TIME; } @@ -990,7 +990,7 @@ static int smdi_load(int reload) continue; } } else if (!strcasecmp(v->name, "pollinginterval")) { - if (sscanf(v->value, "%u", &mwi_monitor.polling_interval) != 1) { + if (sscanf(v->value, "%30u", &mwi_monitor.polling_interval) != 1) { ast_log(LOG_ERROR, "Invalid value for pollinginterval: %s\n", v->value); mwi_monitor.polling_interval = DEFAULT_POLLING_INTERVAL; } @@ -1100,7 +1100,7 @@ static int smdi_msg_retrieve_read(struct ast_channel *chan, const char *cmd, cha } if (!ast_strlen_zero(args.timeout)) { - if (sscanf(args.timeout, "%u", &timeout) != 1) { + if (sscanf(args.timeout, "%30u", &timeout) != 1) { ast_log(LOG_ERROR, "'%s' is not a valid timeout\n", args.timeout); timeout = SMDI_RETRIEVE_TIMEOUT_DEFAULT; } diff --git a/res/snmp/agent.c b/res/snmp/agent.c index 92e577985..bb6a4464c 100644 --- a/res/snmp/agent.c +++ b/res/snmp/agent.c @@ -745,7 +745,7 @@ static u_char *ast_var_Version(struct variable *vp, oid *name, size_t *length, return (u_char *)version; } case ASTVERTAG: - sscanf(ast_get_version_num(), "%lu", &long_ret); + sscanf(ast_get_version_num(), "%30lu", &long_ret); return (u_char *)&long_ret; default: break; -- cgit v1.2.3