aboutsummaryrefslogtreecommitdiffstats
path: root/main/asterisk.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/asterisk.c')
-rw-r--r--main/asterisk.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index e8bac98c3..2abee13c6 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -1165,7 +1165,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));
@@ -2025,10 +2025,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;
}
@@ -2065,13 +2065,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, "%1d", &which) == 1) {
switch (which) {
case 1:
snprintf(p, sizeof(prompt) - strlen(prompt), "%.2f", avg1);
@@ -2716,7 +2716,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
@@ -2764,7 +2764,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")) {
@@ -2773,7 +2773,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 */
@@ -2815,7 +2815,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
@@ -2823,7 +2823,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;
}
@@ -2962,7 +2962,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;
@@ -3002,11 +3002,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':