diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/acl.c | 4 | ||||
-rw-r--r-- | main/asterisk.c | 20 | ||||
-rw-r--r-- | main/cdr.c | 4 | ||||
-rw-r--r-- | main/channel.c | 4 | ||||
-rw-r--r-- | main/cli.c | 6 | ||||
-rw-r--r-- | main/dnsmgr.c | 2 | ||||
-rw-r--r-- | main/frame.c | 4 | ||||
-rw-r--r-- | main/indications.c | 24 | ||||
-rw-r--r-- | main/manager.c | 12 | ||||
-rw-r--r-- | main/pbx.c | 12 | ||||
-rw-r--r-- | main/utils.c | 2 |
11 files changed, 47 insertions, 47 deletions
diff --git a/main/acl.c b/main/acl.c index 4a5e16485..8f388a3d7 100644 --- a/main/acl.c +++ b/main/acl.c @@ -328,7 +328,7 @@ struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path) nm++; } if (!strchr(nm, '.')) { - if ((sscanf(nm, "%d", &x) == 1) && (x >= 0) && (x <= 32)) { + if ((sscanf(nm, "%30d", &x) == 1) && (x >= 0) && (x <= 32)) { y = 0; for (z = 0; z < x; z++) { y >>= 1; @@ -447,7 +447,7 @@ int ast_str2tos(const char *value, unsigned int *tos) int fval; unsigned int x; - if (sscanf(value, "%i", &fval) == 1) { + if (sscanf(value, "%30i", &fval) == 1) { *tos = fval & 0xFF; return 0; } diff --git a/main/asterisk.c b/main/asterisk.c index e0b76eab1..d915b4bdb 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1117,7 +1117,7 @@ static int ast_makesocket(void) if (!ast_strlen_zero(ast_config_AST_CTL_PERMISSIONS)) { int p1; mode_t p; - sscanf(ast_config_AST_CTL_PERMISSIONS, "%o", &p1); + sscanf(ast_config_AST_CTL_PERMISSIONS, "%30o", &p1); p = p1; if ((chmod(ast_config_AST_SOCKET, p)) < 0) ast_log(LOG_WARNING, "Unable to change file permissions of %s: %s\n", ast_config_AST_SOCKET, strerror(errno)); @@ -1891,10 +1891,10 @@ static char *cli_prompt(EditLine *el) switch (*t) { case 'C': /* color */ t++; - if (sscanf(t, "%d;%d%n", &fgcolor, &bgcolor, &i) == 2) { + if (sscanf(t, "%30d;%30d%n", &fgcolor, &bgcolor, &i) == 2) { strncat(p, term_color_code(term_code, fgcolor, bgcolor, sizeof(term_code)),sizeof(prompt) - strlen(prompt) - 1); t += i - 1; - } else if (sscanf(t, "%d%n", &fgcolor, &i) == 1) { + } else if (sscanf(t, "%30d%n", &fgcolor, &i) == 1) { strncat(p, term_color_code(term_code, fgcolor, 0, sizeof(term_code)),sizeof(prompt) - strlen(prompt) - 1); t += i - 1; } @@ -1940,13 +1940,13 @@ static char *cli_prompt(EditLine *el) float avg1, avg2, avg3; int actproc, totproc, npid, which; - if (fscanf(LOADAVG, "%f %f %f %d/%d %d", + if (fscanf(LOADAVG, "%30f %30f %30f %30d/%30d %30d", &avg1, &avg2, &avg3, &actproc, &totproc, &npid) != 6) { ast_log(LOG_WARNING, "parsing /proc/loadavg failed\n"); fclose(LOADAVG); break; } - if (sscanf(t, "%d", &which) == 1) { + if (sscanf(t, "%30d", &which) == 1) { switch (which) { case 1: snprintf(p, sizeof(prompt) - strlen(prompt), "%.2f", avg1); @@ -2582,7 +2582,7 @@ static void ast_readconfig(void) /* debug level (-d at startup) */ } else if (!strcasecmp(v->name, "debug")) { option_debug = 0; - if (sscanf(v->value, "%d", &option_debug) != 1) { + if (sscanf(v->value, "%30d", &option_debug) != 1) { option_debug = ast_true(v->value); } #if HAVE_WORKING_FORK @@ -2630,7 +2630,7 @@ static void ast_readconfig(void) } else if (!strcasecmp(v->name, "internal_timing")) { ast_set2_flag(&ast_options, ast_true(v->value), AST_OPT_FLAG_INTERNAL_TIMING); } else if (!strcasecmp(v->name, "maxcalls")) { - if ((sscanf(v->value, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0)) { + if ((sscanf(v->value, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0)) { option_maxcalls = 0; } } else if (!strcasecmp(v->name, "maxload")) { @@ -2639,7 +2639,7 @@ static void ast_readconfig(void) if (getloadavg(test, 1) == -1) { ast_log(LOG_ERROR, "Cannot obtain load average on this system. 'maxload' option disabled.\n"); option_maxload = 0.0; - } else if ((sscanf(v->value, "%lf", &option_maxload) != 1) || (option_maxload < 0.0)) { + } else if ((sscanf(v->value, "%30lf", &option_maxload) != 1) || (option_maxload < 0.0)) { option_maxload = 0.0; } /* What user to run as */ @@ -2774,11 +2774,11 @@ int main(int argc, char *argv[]) ast_set_flag(&ast_options, AST_OPT_FLAG_MUTE); break; case 'M': - if ((sscanf(optarg, "%d", &option_maxcalls) != 1) || (option_maxcalls < 0)) + if ((sscanf(optarg, "%30d", &option_maxcalls) != 1) || (option_maxcalls < 0)) option_maxcalls = 0; break; case 'L': - if ((sscanf(optarg, "%lf", &option_maxload) != 1) || (option_maxload < 0.0)) + if ((sscanf(optarg, "%30lf", &option_maxload) != 1) || (option_maxload < 0.0)) option_maxload = 0.0; break; case 'q': diff --git a/main/cdr.c b/main/cdr.c index cd051003b..1e413c640 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -1428,7 +1428,7 @@ static int do_reload(void) batchsafeshutdown = ast_true(batchsafeshutdown_value); } if ((size_value = ast_variable_retrieve(config, "general", "size"))) { - if (sscanf(size_value, "%d", &cfg_size) < 1) + if (sscanf(size_value, "%30d", &cfg_size) < 1) ast_log(LOG_WARNING, "Unable to convert '%s' to a numeric value.\n", size_value); else if (cfg_size < 0) ast_log(LOG_WARNING, "Invalid maximum batch size '%d' specified, using default\n", cfg_size); @@ -1436,7 +1436,7 @@ static int do_reload(void) batchsize = cfg_size; } if ((time_value = ast_variable_retrieve(config, "general", "time"))) { - if (sscanf(time_value, "%d", &cfg_time) < 1) + if (sscanf(time_value, "%30d", &cfg_time) < 1) ast_log(LOG_WARNING, "Unable to convert '%s' to a numeric value.\n", time_value); else if (cfg_time < 0) ast_log(LOG_WARNING, "Invalid maximum batch time '%d' specified, using default\n", cfg_time); diff --git a/main/channel.c b/main/channel.c index 6b1582180..5e0dc8d55 100644 --- a/main/channel.c +++ b/main/channel.c @@ -4785,9 +4785,9 @@ ast_group_t ast_get_group(const char *s) c = ast_strdupa(s); while ((piece = strsep(&c, ","))) { - if (sscanf(piece, "%d-%d", &start, &finish) == 2) { + if (sscanf(piece, "%30d-%30d", &start, &finish) == 2) { /* Range */ - } else if (sscanf(piece, "%d", &start)) { + } else if (sscanf(piece, "%30d", &start)) { /* Just one */ finish = start; } else { diff --git a/main/cli.c b/main/cli.c index fe39334c1..b928fde63 100644 --- a/main/cli.c +++ b/main/cli.c @@ -319,7 +319,7 @@ static int handle_set_debug(int fd, int argc, char *argv[]) if (argc > 5) return RESULT_SHOWUSAGE; - if (sscanf(argv[3], "%d", &newlevel) != 1) + if (sscanf(argv[3], "%30d", &newlevel) != 1) return RESULT_SHOWUSAGE; if (argc == 4) { @@ -334,7 +334,7 @@ static int handle_set_debug(int fd, int argc, char *argv[]) if (argc < 5 || argc > 6) return RESULT_SHOWUSAGE; - if (sscanf(argv[4], "%d", &newlevel) != 1) + if (sscanf(argv[4], "%30d", &newlevel) != 1) return RESULT_SHOWUSAGE; if (argc == 5) { @@ -387,7 +387,7 @@ static int handle_debuglevel_deprecated(int fd, int argc, char *argv[]) char *filename = "<any>"; if ((argc < 3) || (argc > 4)) return RESULT_SHOWUSAGE; - if (sscanf(argv[2], "%d", &newlevel) != 1) + if (sscanf(argv[2], "%30d", &newlevel) != 1) return RESULT_SHOWUSAGE; option_debug = newlevel; if (argc == 4) { diff --git a/main/dnsmgr.c b/main/dnsmgr.c index deb5c73db..6be5720d0 100644 --- a/main/dnsmgr.c +++ b/main/dnsmgr.c @@ -380,7 +380,7 @@ static int do_reload(int loading) enabled = ast_true(enabled_value); } if ((interval_value = ast_variable_retrieve(config, "general", "refreshinterval"))) { - if (sscanf(interval_value, "%d", &interval) < 1) + if (sscanf(interval_value, "%30d", &interval) < 1) ast_log(LOG_WARNING, "Unable to convert '%s' to a numeric value.\n", interval_value); else if (interval < 0) ast_log(LOG_WARNING, "Invalid refresh interval '%d' specified, using default\n", interval); diff --git a/main/frame.c b/main/frame.c index cf13b6a29..9de8a700a 100644 --- a/main/frame.c +++ b/main/frame.c @@ -765,7 +765,7 @@ static int show_codec_n_deprecated(int fd, int argc, char *argv[]) if (argc != 3) return RESULT_SHOWUSAGE; - if (sscanf(argv[2],"%d",&codec) != 1) + if (sscanf(argv[2],"%30d",&codec) != 1) return RESULT_SHOWUSAGE; for (i = 0; i < 32; i++) @@ -787,7 +787,7 @@ static int show_codec_n(int fd, int argc, char *argv[]) if (argc != 4) return RESULT_SHOWUSAGE; - if (sscanf(argv[3],"%d",&codec) != 1) + if (sscanf(argv[3],"%30d",&codec) != 1) return RESULT_SHOWUSAGE; for (i = 0; i < 32; i++) diff --git a/main/indications.c b/main/indications.c index 64f96b5d5..8255e20f0 100644 --- a/main/indications.c +++ b/main/indications.c @@ -236,46 +236,46 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst, s++; else if (d.reppos == -1) d.reppos = d.nitems; - if (sscanf(s, "%d+%d/%d", &freq1, &freq2, &time) == 3) { + if (sscanf(s, "%30d+%30d/%30d", &freq1, &freq2, &time) == 3) { /* f1+f2/time format */ - } else if (sscanf(s, "%d+%d", &freq1, &freq2) == 2) { + } else if (sscanf(s, "%30d+%30d", &freq1, &freq2) == 2) { /* f1+f2 format */ time = 0; - } else if (sscanf(s, "%d*%d/%d", &freq1, &freq2, &time) == 3) { + } else if (sscanf(s, "%30d*%30d/%30d", &freq1, &freq2, &time) == 3) { /* f1*f2/time format */ modulate = 1; - } else if (sscanf(s, "%d*%d", &freq1, &freq2) == 2) { + } else if (sscanf(s, "%30d*%30d", &freq1, &freq2) == 2) { /* f1*f2 format */ time = 0; modulate = 1; - } else if (sscanf(s, "%d/%d", &freq1, &time) == 2) { + } else if (sscanf(s, "%30d/%30d", &freq1, &time) == 2) { /* f1/time format */ freq2 = 0; - } else if (sscanf(s, "%d", &freq1) == 1) { + } else if (sscanf(s, "%30d", &freq1) == 1) { /* f1 format */ freq2 = 0; time = 0; - } else if (sscanf(s, "M%d+M%d/%d", &freq1, &freq2, &time) == 3) { + } else if (sscanf(s, "M%30d+M%30d/%30d", &freq1, &freq2, &time) == 3) { /* Mf1+Mf2/time format */ midinote = 1; - } else if (sscanf(s, "M%d+M%d", &freq1, &freq2) == 2) { + } else if (sscanf(s, "M%30d+M%30d", &freq1, &freq2) == 2) { /* Mf1+Mf2 format */ time = 0; midinote = 1; - } else if (sscanf(s, "M%d*M%d/%d", &freq1, &freq2, &time) == 3) { + } else if (sscanf(s, "M%30d*M%30d/%30d", &freq1, &freq2, &time) == 3) { /* Mf1*Mf2/time format */ modulate = 1; midinote = 1; - } else if (sscanf(s, "M%d*M%d", &freq1, &freq2) == 2) { + } else if (sscanf(s, "M%30d*M%30d", &freq1, &freq2) == 2) { /* Mf1*Mf2 format */ time = 0; modulate = 1; midinote = 1; - } else if (sscanf(s, "M%d/%d", &freq1, &time) == 2) { + } else if (sscanf(s, "M%30d/%30d", &freq1, &time) == 2) { /* Mf1/time format */ freq2 = -1; midinote = 1; - } else if (sscanf(s, "M%d", &freq1) == 1) { + } else if (sscanf(s, "M%30d", &freq1) == 1) { /* Mf1 format */ freq2 = -1; time = 0; diff --git a/main/manager.c b/main/manager.c index f62611fce..a8bd1edbb 100644 --- a/main/manager.c +++ b/main/manager.c @@ -1329,7 +1329,7 @@ static int action_waitevent(struct mansession *s, const struct message *m) snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id); if (!ast_strlen_zero(timeouts)) { - sscanf(timeouts, "%i", &timeout); + sscanf(timeouts, "%30i", &timeout); } ast_mutex_lock(&s->session->__lock); @@ -1690,7 +1690,7 @@ static int action_redirect(struct mansession *s, const struct message *m) astman_send_error(s, m, "Channel not specified"); return 0; } - if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) { + if (!ast_strlen_zero(priority) && (sscanf(priority, "%30d", &pi) != 1)) { if ((pi = ast_findlabel_extension(NULL, context, exten, priority, NULL)) < 1) { astman_send_error(s, m, "Invalid priority"); return 0; @@ -1938,13 +1938,13 @@ static int action_originate(struct mansession *s, const struct message *m) astman_send_error(s, m, "Channel not specified"); return 0; } - if (!ast_strlen_zero(priority) && (sscanf(priority, "%d", &pi) != 1)) { + if (!ast_strlen_zero(priority) && (sscanf(priority, "%30d", &pi) != 1)) { if ((pi = ast_findlabel_extension(NULL, context, exten, priority, NULL)) < 1) { astman_send_error(s, m, "Invalid priority"); return 0; } } - if (!ast_strlen_zero(timeout) && (sscanf(timeout, "%d", &to) != 1)) { + if (!ast_strlen_zero(timeout) && (sscanf(timeout, "%30d", &to) != 1)) { astman_send_error(s, m, "Invalid timeout"); return 0; } @@ -2790,7 +2790,7 @@ static char *generic_http_callback(int format, struct sockaddr_in *requestor, co for (v = params; v; v = v->next) { if (!strcasecmp(v->name, "mansession_id")) { - sscanf(v->value, "%x", &ident); + sscanf(v->value, "%30x", &ident); break; } } @@ -3068,7 +3068,7 @@ int init_manager(void) webenabled = ast_true(val); if ((val = ast_variable_retrieve(cfg, "general", "port"))) { - if (sscanf(val, "%d", &portno) != 1) { + if (sscanf(val, "%5d", &portno) != 1) { ast_log(LOG_WARNING, "Invalid port number '%s'\n", val); portno = DEFAULT_MANAGER_PORT; } diff --git a/main/pbx.c b/main/pbx.c index b3a448214..f34661ce5 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -1095,7 +1095,7 @@ static int parse_variable_name(char *var, int *offset, int *length, int *isfunc) parens--; } else if (*var == ':' && parens == 0) { *var++ = '\0'; - sscanf(var, "%d:%d", offset, length); + sscanf(var, "%30d:%30d", offset, length); return 1; /* offset:length valid */ } } @@ -4069,7 +4069,7 @@ static int lookup_name(const char *s, char *const names[], int max) if (!strcasecmp(s, names[i])) return i+1; } - } else if (sscanf(s, "%d", &i) == 1 && i >= 1 && i <= max) { + } else if (sscanf(s, "%30d", &i) == 1 && i >= 1 && i <= max) { return i; } return 0; /* error return */ @@ -4156,11 +4156,11 @@ static void get_timerange(struct ast_timing *i, char *times) ast_log(LOG_WARNING, "Invalid time range. Assuming no restrictions based on time.\n"); return; } - if (sscanf(times, "%d:%d", &s1, &s2) != 2) { + if (sscanf(times, "%2d:%2d", &s1, &s2) != 2) { ast_log(LOG_WARNING, "%s isn't a time. Assuming no restrictions based on time.\n", times); return; } - if (sscanf(e, "%d:%d", &e1, &e2) != 2) { + if (sscanf(e, "%2d:%2d", &e1, &e2) != 2) { ast_log(LOG_WARNING, "%s isn't a time. Assuming no restrictions based on time.\n", e); return; } @@ -5369,7 +5369,7 @@ static void wait_for_hangup(struct ast_channel *chan, void *data) struct ast_frame *f; int waittime; - if (ast_strlen_zero(data) || (sscanf(data, "%d", &waittime) != 1) || (waittime < 0)) + if (ast_strlen_zero(data) || (sscanf(data, "%30d", &waittime) != 1) || (waittime < 0)) waittime = -1; if (waittime > -1) { ast_safe_sleep(chan, waittime * 1000); @@ -6410,7 +6410,7 @@ int ast_parseable_goto(struct ast_channel *chan, const char *goto_string) mode = -1; pri++; } - if (sscanf(pri, "%d", &ipri) != 1) { + if (sscanf(pri, "%30d", &ipri) != 1) { if ((ipri = ast_findlabel_extension(chan, context ? context : chan->context, exten ? exten : chan->exten, pri, chan->cid.cid_num)) < 1) { ast_log(LOG_WARNING, "Priority '%s' must be a number > 0, or valid label\n", pri); diff --git a/main/utils.c b/main/utils.c index 6ff44dd48..8c601b3d7 100644 --- a/main/utils.c +++ b/main/utils.c @@ -1349,7 +1349,7 @@ int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed) return -1; /* only integer at the moment, but one day we could accept more formats */ - if (sscanf(src, "%ld%n", &t, &scanned) == 1) { + if (sscanf(src, "%30ld%n", &t, &scanned) == 1) { *dst = t; if (consumed) *consumed = scanned; |