diff options
Diffstat (limited to 'sysklogd')
-rw-r--r-- | sysklogd/klogd.c | 3 | ||||
-rw-r--r-- | sysklogd/logger.c | 9 | ||||
-rw-r--r-- | sysklogd/syslogd.c | 14 |
3 files changed, 10 insertions, 16 deletions
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c index e629bec5d..f735d9fc1 100644 --- a/sysklogd/klogd.c +++ b/sysklogd/klogd.c | |||
@@ -43,7 +43,6 @@ int klogd_main(int argc, char **argv) | |||
43 | int i, n, lastc; | 43 | int i, n, lastc; |
44 | char *start; | 44 | char *start; |
45 | 45 | ||
46 | |||
47 | { | 46 | { |
48 | unsigned opt; | 47 | unsigned opt; |
49 | 48 | ||
@@ -52,7 +51,7 @@ int klogd_main(int argc, char **argv) | |||
52 | 51 | ||
53 | if (opt & OPT_LEVEL) { | 52 | if (opt & OPT_LEVEL) { |
54 | /* Valid levels are between 1 and 8 */ | 53 | /* Valid levels are between 1 and 8 */ |
55 | console_log_level = bb_xgetlarg(start, 10, 1, 8); | 54 | console_log_level = xatoul_range(start, 1, 8); |
56 | } | 55 | } |
57 | 56 | ||
58 | if (!(opt & OPT_FOREGROUND)) { | 57 | if (!(opt & OPT_FOREGROUND)) { |
diff --git a/sysklogd/logger.c b/sysklogd/logger.c index 15a4bfb82..8901bd79f 100644 --- a/sysklogd/logger.c +++ b/sysklogd/logger.c | |||
@@ -48,14 +48,14 @@ static int decode(char *name, CODE * codetab) | |||
48 | CODE *c; | 48 | CODE *c; |
49 | 49 | ||
50 | if (isdigit(*name)) | 50 | if (isdigit(*name)) |
51 | return (atoi(name)); | 51 | return atoi(name); |
52 | for (c = codetab; c->c_name; c++) { | 52 | for (c = codetab; c->c_name; c++) { |
53 | if (!strcasecmp(name, c->c_name)) { | 53 | if (!strcasecmp(name, c->c_name)) { |
54 | return (c->c_val); | 54 | return c->c_val; |
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | return (-1); | 58 | return -1; |
59 | } | 59 | } |
60 | 60 | ||
61 | /* Decode a symbolic name to a numeric value | 61 | /* Decode a symbolic name to a numeric value |
@@ -177,6 +177,3 @@ int logger_main(int argc, char **argv) | |||
177 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 177 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
178 | * SUCH DAMAGE. | 178 | * SUCH DAMAGE. |
179 | */ | 179 | */ |
180 | |||
181 | |||
182 | |||
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 254d7e73c..9e030bd63 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -575,20 +575,20 @@ int syslogd_main(int argc, char **argv) | |||
575 | 575 | ||
576 | /* do normal option parsing */ | 576 | /* do normal option parsing */ |
577 | getopt32(argc, argv, OPTION_STR, OPTION_PARAM); | 577 | getopt32(argc, argv, OPTION_STR, OPTION_PARAM); |
578 | if (option_mask32 & OPT_mark) MarkInterval = atoi(opt_m) * 60; // -m | 578 | if (option_mask32 & OPT_mark) MarkInterval = xatoul_range(opt_m, 0, INT_MAX/60) * 60; // -m |
579 | //if (option_mask32 & OPT_nofork) // -n | 579 | //if (option_mask32 & OPT_nofork) // -n |
580 | //if (option_mask32 & OPT_outfile) // -O | 580 | //if (option_mask32 & OPT_outfile) // -O |
581 | if (option_mask32 & OPT_loglevel) { // -l | 581 | if (option_mask32 & OPT_loglevel) { // -l |
582 | logLevel = atoi(opt_l); | 582 | logLevel = xatoi_u(opt_l); |
583 | /* Valid levels are between 1 and 8 */ | 583 | /* Valid levels are between 1 and 8 */ |
584 | if (logLevel < 1 || logLevel > 8) | 584 | if (logLevel < 1 || logLevel > 8) |
585 | bb_show_usage(); | 585 | bb_show_usage(); |
586 | } | 586 | } |
587 | //if (option_mask32 & OPT_small) // -S | 587 | //if (option_mask32 & OPT_small) // -S |
588 | #if ENABLE_FEATURE_ROTATE_LOGFILE | 588 | #if ENABLE_FEATURE_ROTATE_LOGFILE |
589 | if (option_mask32 & OPT_filesize) logFileSize = atoi(opt_s) * 1024; // -s | 589 | if (option_mask32 & OPT_filesize) logFileSize = xatoul_range(opt_s, 0, INT_MAX/1024) * 1024; // -s |
590 | if (option_mask32 & OPT_rotatecnt) { // -b | 590 | if (option_mask32 & OPT_rotatecnt) { // -b |
591 | logFileRotate = atoi(opt_b); | 591 | logFileRotate = xatoi_u(opt_b); |
592 | if (logFileRotate > 99) logFileRotate = 99; | 592 | if (logFileRotate > 99) logFileRotate = 99; |
593 | } | 593 | } |
594 | #endif | 594 | #endif |
@@ -598,7 +598,7 @@ int syslogd_main(int argc, char **argv) | |||
598 | char *host = xstrdup(opt_R); | 598 | char *host = xstrdup(opt_R); |
599 | p = strchr(host, ':'); | 599 | p = strchr(host, ':'); |
600 | if (p) { | 600 | if (p) { |
601 | port = atoi(p + 1); | 601 | port = xatou16(p + 1); |
602 | *p = '\0'; | 602 | *p = '\0'; |
603 | } | 603 | } |
604 | remoteaddr.sin_family = AF_INET; | 604 | remoteaddr.sin_family = AF_INET; |
@@ -612,9 +612,7 @@ int syslogd_main(int argc, char **argv) | |||
612 | #if ENABLE_FEATURE_IPC_SYSLOG | 612 | #if ENABLE_FEATURE_IPC_SYSLOG |
613 | if (option_mask32 & OPT_circularlog) { // -C | 613 | if (option_mask32 & OPT_circularlog) { // -C |
614 | if (opt_C) { | 614 | if (opt_C) { |
615 | int buf_size = atoi(opt_C); | 615 | shm_size = xatoul_range(opt_C, 4, INT_MAX/1024) * 1024; |
616 | if (buf_size >= 4) | ||
617 | shm_size = buf_size * 1024; | ||
618 | } | 616 | } |
619 | } | 617 | } |
620 | #endif | 618 | #endif |