diff --git a/src/analyze.c b/src/analyze.c index 0dcd8e7..6721761 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -86,7 +86,6 @@ void do_counting(struct conf_t *state) break; default: abort(); - break; } } /* Size of range size. */ diff --git a/src/dhcpd-pools.c b/src/dhcpd-pools.c index dd52fe9..8e12750 100644 --- a/src/dhcpd-pools.c +++ b/src/dhcpd-pools.c @@ -89,7 +89,7 @@ static void prepare_memory(struct conf_t *state) } /*! \brief The --skip option argument parser. */ -static void skip_arg_parse(struct conf_t *state, char *optarg) +static void skip_arg_parse(struct conf_t *state, char *arg) { enum { OPT_ARG_OK = 0, @@ -109,8 +109,8 @@ static void skip_arg_parse(struct conf_t *state, char *optarg) }; char *value; - while (*optarg != '\0') { - switch (getsubopt(&optarg, tokens, &value)) { + while (*arg != '\0') { + switch (getsubopt(&arg, tokens, &value)) { case OPT_ARG_OK: state->skip_ok = 1; break; diff --git a/src/getdata.c b/src/getdata.c index 9d4e288..7863a6b 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -220,9 +221,11 @@ void parse_config(struct conf_t *state, const int is_include, const char *restri #endif /* HAVE_POSIX_FADVISE */ /* Very hairy stuff begins. */ while (unlikely(!feof(dhcpd_config))) { - char c; + int c; c = fgetc(dhcpd_config); + if (CHAR_MAX < c) + continue; /* Certain characters are magical */ switch (c) { /* Handle comments if they are not quoted */ @@ -317,7 +320,7 @@ void parse_config(struct conf_t *state, const int is_include, const char *restri /* Save to word which clause this is. */ if ((newclause == 1 || argument != ITS_NOTHING_INTERESTING) && (!isspace(c) || 0 < quote)) { - word[i] = c; + word[i] = (char) c; i++; /* Long word which is almost causing overflow. None * of words are this long which the program is diff --git a/src/other.c b/src/other.c index 50f2380..f9df885 100644 --- a/src/other.c +++ b/src/other.c @@ -58,7 +58,7 @@ #include "dhcpd-pools.h" -char *(*cidr_last) (union ipaddr_t *restrict addr, const int mask); +static char *(*cidr_last) (union ipaddr_t *restrict addr, const int mask); static char *cidr_last_v4(union ipaddr_t *restrict addr, const int mask); static char *cidr_last_v6(union ipaddr_t *restrict addr, const int mask); @@ -480,13 +480,13 @@ int * \param Color mode string. * \return color mode enum. */ -int parse_color_mode(const char *restrict optarg) +int parse_color_mode(const char *restrict arg) { - if (!strcmp(optarg, "always")) + if (!strcmp(arg, "always")) return color_on; - if (!strcmp(optarg, "auto")) + if (!strcmp(arg, "auto")) return color_auto; - if (!strcmp(optarg, "never")) + if (!strcmp(arg, "never")) return color_off; return color_unknown; }