mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-01 18:09:41 +00:00
AST-2009-005
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@211528 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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':
|
||||
|
Reference in New Issue
Block a user