diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-10 19:20:57 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-08-10 19:20:57 +0000 |
commit | d1ec1aa57d296243d584ad268d8e61d7d1998569 (patch) | |
tree | 2596a6cb913ad8bd78e4670d298dc1d4682b2d23 /main/asterisk.c | |
parent | 4548c33d84f71a04a0416a26b9f0dea0ae061cc4 (diff) |
AST-2009-005
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@211539 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/asterisk.c')
-rw-r--r-- | main/asterisk.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/main/asterisk.c b/main/asterisk.c index 3e9837641..dbf479314 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1389,7 +1389,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)); @@ -2192,10 +2192,10 @@ static char *cli_prompt(EditLine *editline) 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) { ast_str_append(&prompt, 0, "%s", term_color_code(term_code, fgcolor, bgcolor, sizeof(term_code))); t += i - 1; - } else if (sscanf(t, "%d%n", &fgcolor, &i) == 1) { + } else if (sscanf(t, "%30d%n", &fgcolor, &i) == 1) { ast_str_append(&prompt, 0, "%s", term_color_code(term_code, fgcolor, 0, sizeof(term_code))); t += i - 1; } @@ -2236,7 +2236,7 @@ static char *cli_prompt(EditLine *editline) #ifdef HAVE_GETLOADAVG case 'l': /* load avg */ t++; - if (sscanf(t, "%d", &which) == 1 && which > 0 && which <= 3) { + if (sscanf(t, "%30d", &which) == 1 && which > 0 && which <= 3) { double list[3]; getloadavg(list, 3); ast_str_append(&prompt, 0, "%.2f", list[which - 1]); @@ -2878,7 +2878,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 @@ -2926,7 +2926,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")) { @@ -2935,7 +2935,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; } /* Set the maximum amount of open files */ @@ -2977,7 +2977,7 @@ static void ast_readconfig(void) } else if (!strcasecmp(v->name, "minmemfree")) { /* specify the minimum amount of free memory to retain. Asterisk should stop accepting new calls * if the amount of free memory falls below this watermark */ - if ((sscanf(v->value, "%ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) { + if ((sscanf(v->value, "%30ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) { option_minmemfree = 0; } #endif @@ -2998,7 +2998,7 @@ static void ast_readconfig(void) } for (v = ast_variable_browse(cfg, "compat"); v; v = v->next) { float version; - if (sscanf(v->value, "%f", &version) != 1) { + if (sscanf(v->value, "%30f", &version) != 1) { ast_log(LOG_WARNING, "Compatibility version for option '%s' is not a number: '%s'\n", v->name, v->value); continue; } @@ -3142,7 +3142,7 @@ int main(int argc, char *argv[]) switch (c) { #if defined(HAVE_SYSINFO) case 'e': - if ((sscanf(&optarg[1], "%ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) { + if ((sscanf(&optarg[1], "%30ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) { option_minmemfree = 0; } break; @@ -3182,11 +3182,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': |