]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
ctype macros should take explicitly unsigned input
authorAlan T. DeKok <aland@freeradius.org>
Mon, 31 Oct 2022 20:52:56 +0000 (16:52 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 31 Oct 2022 20:52:56 +0000 (16:52 -0400)
to avoid chars with high bits being converted to negative numbers

perl -p -i -e 's/(tolower|toupper|isupper|islower|isdigit|isalpha|isspace|isxdigit)\(\s*\*/${1}((uint8_t) */g' $(find . -name "*.[ch]" -print)
perl -p -i -e 's/(tolower|toupper|isupper|islower|isdigit|isalpha|isspace|isxdigit)\(\(int\)/${1}((uint8_t)/g' $(find . -name "*.[ch]" -print)

Manual port of commit d80731fd1ff, as some code has changed

41 files changed:
src/lib/dict.c
src/lib/getaddrinfo.c
src/lib/misc.c
src/lib/pair.c
src/lib/snprintf.c
src/lib/token.c
src/lib/value.c
src/main/client.c
src/main/collectd.c
src/main/command.c
src/main/conffile.c
src/main/evaluate.c
src/main/exec.c
src/main/files.c
src/main/map.c
src/main/parser.c
src/main/radattr.c
src/main/radclient.c
src/main/realms.c
src/main/tls.c
src/main/tmpl.c
src/main/unittest.c
src/main/xlat.c
src/modules/proto_dhcp/dhcpclient.c
src/modules/proto_dhcp/rlm_dhcp.c
src/modules/rlm_counter/rlm_counter.c
src/modules/rlm_eap/eap.c
src/modules/rlm_eap/radeapclient.c
src/modules/rlm_expr/rlm_expr.c
src/modules/rlm_json/rlm_json.c
src/modules/rlm_ldap/rlm_ldap.c
src/modules/rlm_logintime/timestr.c
src/modules/rlm_mschap/rlm_mschap.c
src/modules/rlm_mschap/smbdes.c
src/modules/rlm_rest/rest.c
src/modules/rlm_rest/rlm_rest.c
src/modules/rlm_sql/drivers/rlm_sql_mongo/rlm_sql_mongo.c
src/modules/rlm_sql_map/rlm_sql_map.c
src/modules/rlm_sqlcounter/rlm_sqlcounter.c
src/modules/rlm_unpack/rlm_unpack.c
src/modules/rlm_yubikey/rlm_yubikey.c

index 479bf1104ee02c98a8ef10939a78fc0a6206fcfa..c171abd434454011c7ff518e937efe9cd70c37d7 100644 (file)
@@ -1359,7 +1359,7 @@ static int sscanf_i(char const *str, unsigned int *pvalue)
 
                if (*str == '.') break;
 
-               c = memchr(tab, tolower((int) *str), base);
+               c = memchr(tab, tolower((uint8_t) *str), base);
                if (!c) return 0;
 
                rcode *= base;
@@ -2057,9 +2057,9 @@ static int parse_format(char const *fn, int line, char const *format, int *ptype
 
        p = format + 7;
        if ((strlen(p) < 3) ||
-           !isdigit((int) p[0]) ||
+           !isdigit((uint8_t) p[0]) ||
            (p[1] != ',') ||
-           !isdigit((int) p[2]) ||
+           !isdigit((uint8_t) p[2]) ||
            (p[3] && (p[3] != ','))) {
                fr_strerror_printf("dict_init: %s[%d]: Invalid format for VENDOR.  Expected text like \"1,1\", got \"%s\"",
                                   fn, line, p);
@@ -2130,7 +2130,7 @@ static int process_vendor(char const* fn, int const line, char **argv,
        /*
         *       Validate all entries
         */
-       if (!isdigit((int) argv[1][0])) {
+       if (!isdigit((uint8_t) argv[1][0])) {
                fr_strerror_printf("dict_init: %s[%d]: invalid value",
                        fn, line);
                return -1;
index 2022362d3d095e3ca25814906e625cf018fcc5e1..1c8aa9a8666f7032ba23702e27ef88c7eb1ed68e 100644 (file)
@@ -287,7 +287,7 @@ int getaddrinfo(char const *hostname, char const *servname, struct addrinfo cons
        }
 
        if (servname) {
-               if (isdigit((int)*servname)) {
+               if (isdigit((uint8_t)*servname)) {
                        port = htons(atoi(servname));
                } else {
                        struct          servent *se;
index 9dbb73a5992d36cd7e931304460484bc75e0cc70..36378ec40c9387da9b4c4c1081aeaa93e59a7142 100644 (file)
@@ -864,7 +864,7 @@ uint8_t *ifid_aton(char const *ifid_str, uint8_t *ifid)
                        num_id = 0;
                        if ((idx += 2) > 6)
                                return NULL;
-               } else if ((pch = strchr(xdigits, tolower(*p))) != NULL) {
+               } else if ((pch = strchr(xdigits, tolower((uint8_t) *p))) != NULL) {
                        if (++num_id > 4)
                                return NULL;
                        /*
@@ -1325,8 +1325,8 @@ size_t fr_hex2bin(uint8_t *bin, size_t outlen, char const *hex, size_t inlen)
        if (len > outlen) len = outlen;
 
        for (i = 0; i < len; i++) {
-               if(!(c1 = memchr(hextab, tolower((int) hex[i << 1]), sizeof(hextab))) ||
-                  !(c2 = memchr(hextab, tolower((int) hex[(i << 1) + 1]), sizeof(hextab))))
+               if(!(c1 = memchr(hextab, tolower((uint8_t) hex[i << 1]), sizeof(hextab))) ||
+                  !(c2 = memchr(hextab, tolower((uint8_t) hex[(i << 1) + 1]), sizeof(hextab))))
                        break;
                bin[i] = ((c1-hextab)<<4) + (c2-hextab);
        }
@@ -1403,7 +1403,7 @@ uint32_t fr_strtoul(char const *value, char **end)
 bool is_whitespace(char const *value)
 {
        do {
-               if (!isspace(*value)) return false;
+               if (!isspace((uint8_t) *value)) return false;
                value++;
        } while (*value);
 
@@ -1442,7 +1442,7 @@ bool is_integer(char const *value)
 {
 #ifndef __clang_analyzer__
        do {
-               if (!isdigit(*value)) return false;
+               if (!isdigit((uint8_t) *value)) return false;
                value++;
        } while (*value);
 
@@ -1453,7 +1453,7 @@ bool is_integer(char const *value)
         *      other functions doing similar things.
         */
 #else
-       if (!isdigit(*value)) return false;
+       if (!isdigit((uint8_t) *value)) return false;
 #endif
 
        return true;
index 898e1e85296bfa0a8a89976f2329f123054eac12..c86deb8a142c0fb366b603993c5e8e0760c1debf 100644 (file)
@@ -1795,7 +1795,7 @@ FR_TOKEN fr_pair_raw_from_str(char const **ptr, VALUE_PAIR_RAW *raw)
                 *      =
                 *      value
                 */
-               if ((*p == ':') && (!isdigit((int) p[1]))) {
+               if ((*p == ':') && (!isdigit((uint8_t) p[1]))) {
                        break;
                }
 
@@ -1814,13 +1814,13 @@ FR_TOKEN fr_pair_raw_from_str(char const **ptr, VALUE_PAIR_RAW *raw)
         *      Look for tag (:#).  This is different from :=, which
         *      is an operator.
         */
-       if ((*p == ':') && (isdigit((int) p[1]))) {
+       if ((*p == ':') && (isdigit((uint8_t) p[1]))) {
                if (q >= (raw->l_opand + sizeof(raw->l_opand))) {
                        goto too_long;
                }
                *(q++) = *(p++);
 
-               while (isdigit((int) *p)) {
+               while (isdigit((uint8_t) *p)) {
                        if (q >= (raw->l_opand + sizeof(raw->l_opand))) {
                                goto too_long;
                        }
index 4f79a32d64a0ac1388012f7f060347b6d79acddf..9002464f9e1693ee99707551c4f25603cb1dc3c8 100644 (file)
@@ -313,7 +313,7 @@ double d;
                PUT_CHAR('0', p); PUT_CHAR(*p->pf, p);
        }
        while (*tmp) { /* hexa */
-               PUT_CHAR((*p->pf == 'X' ? toupper(*tmp) : *tmp), p);
+               PUT_CHAR((*p->pf == 'X' ? toupper((uint8_t) *tmp) : *tmp), p);
                tmp++;
        }
        PAD_LEFT(p);
@@ -482,7 +482,7 @@ struct DATA * p;
                        case '1': case '2': case '3':
                        case '4': case '5': case '6':
                        case '7': case '8': case '9':            /* gob all the digits */
-       for (i = 0; isdigit(*s); i++, s++)
+       for (i = 0; isdigit((uint8_t) *s); i++, s++)
                if (i < MAX_FIELD/2 - 1)
                        number[i] = *s;
        number[i] = '\0';
index a7978622e6139536d6ed28883671a66a2903c01d..33b858bd62ad7b5e6aece4738e468617885126bf 100644 (file)
@@ -187,7 +187,7 @@ static FR_TOKEN getthing(char const **ptr, char *buf, int buflen, bool tok,
        /* Skip whitespace */
        p = *ptr;
 
-       while (*p && isspace((int) *p)) p++;
+       while (*p && isspace((uint8_t) *p)) p++;
 
        if (!*p) {
                *ptr = p;
@@ -241,7 +241,7 @@ static FR_TOKEN getthing(char const **ptr, char *buf, int buflen, bool tok,
                 *      comma.
                 */
                if (!quote) {
-                       if (isspace((int) *p)) {
+                       if (isspace((uint8_t) *p)) {
                                break;
                        }
 
@@ -340,7 +340,7 @@ static FR_TOKEN getthing(char const **ptr, char *buf, int buflen, bool tok,
 
 done:
        /* Skip whitespace again. */
-       while (*p && isspace((int) *p)) p++;
+       while (*p && isspace((uint8_t) *p)) p++;
 
        *ptr = p;
 
@@ -392,7 +392,7 @@ FR_TOKEN getstring(char const **ptr, char *buf, int buflen, bool unescape)
 
        p = *ptr;
 
-       while (*p && (isspace((int)*p))) p++;
+       while (*p && (isspace((uint8_t)*p))) p++;
 
        *ptr = p;
 
index 05d42e269a476576bdce1501894e0e4a6d67dae8..aa4989741c7059ce254b27786bf4a0cd59ee79a9 100644 (file)
@@ -918,11 +918,11 @@ ssize_t value_data_from_str(TALLOC_CTX *ctx, value_data_t *dst,
                while (*cp) {
                        if (cp[1] == ':') {
                                c1 = hextab;
-                               c2 = memchr(hextab, tolower((int) cp[0]), 16);
+                               c2 = memchr(hextab, tolower((uint8_t) cp[0]), 16);
                                cp += 2;
                        } else if ((cp[1] != '\0') && ((cp[2] == ':') || (cp[2] == '\0'))) {
-                               c1 = memchr(hextab, tolower((int) cp[0]), 16);
-                               c2 = memchr(hextab, tolower((int) cp[1]), 16);
+                               c1 = memchr(hextab, tolower((uint8_t) cp[0]), 16);
+                               c2 = memchr(hextab, tolower((uint8_t) cp[1]), 16);
                                cp += 2;
                                if (*cp == ':') cp++;
                        } else {
index b0b3e24028c9d634b1a4d51b3b0e3d2ffd8798e4..b5c38d408f8f9db64e64cfa26dbee080cc4f3307 100644 (file)
@@ -656,8 +656,8 @@ RADCLIENT_LIST *client_list_parse_section(CONF_SECTION *section, UNUSED bool tls
                                 *      Check for valid characters
                                 */
                                for (p = dp->d_name; *p != '\0'; p++) {
-                                       if (isalpha((int)*p) ||
-                                           isdigit((int)*p) ||
+                                       if (isalpha((uint8_t)*p) ||
+                                           isdigit((uint8_t)*p) ||
                                            (*p == ':') ||
                                            (*p == '.')) continue;
                                        break;
index 77f0db091549300b963b199d3cb3aafc2b663d55..b7204719c7935e9a8392a082973e43b0b6673873 100644 (file)
@@ -264,7 +264,7 @@ rs_stats_tmpl_t *rs_stats_collectd_init_latency(TALLOC_CTX *ctx, rs_stats_tmpl_t
 
 #define INIT_STATS(_ti, _v) do {\
                strlcpy(buffer, fr_packet_codes[code], sizeof(buffer)); \
-               for (p = buffer; *p; ++p) *p = tolower(*p);\
+               for (p = buffer; *p; ++p) *p = tolower((uint8_t) *p);\
                last = *tmpl = rs_stats_collectd_init(ctx, conf, type, _ti, buffer, stats, _v);\
                if (!*tmpl) {\
                        TALLOC_FREE(*out);\
index 246b54b82ec37b02491c40701e53c2ae15ec9243..12d1afdfdb1a8c675526f29a5fd2c5336f2484f5 100644 (file)
@@ -1661,7 +1661,7 @@ static home_server_t *get_home_server(rad_listen_t *listener, int argc,
                return NULL;
        }
 
-       if (isdigit(*argv[1])) {
+       if (isdigit((uint8_t) *argv[1])) {
                if (ip_hton(&ipaddr, AF_UNSPEC, argv[0], false) < 0) {
                        cprintf_error(listener, "Failed parsing IP address; %s\n",
                                      fr_strerror());
index 7fe658711ffcc665bcc777d860c3e66d21d3856f..8a9297b5d6b6e8f039fa475364b0e1c00fb2c270 100644 (file)
@@ -2318,7 +2318,7 @@ static int cf_section_read(char const *filename, int *lineno, FILE *fp,
 
                if (has_spaces) {
                        ptr = cbuf;
-                       while (isspace((int) *ptr)) ptr++;
+                       while (isspace((uint8_t) *ptr)) ptr++;
 
                        if (ptr > cbuf) {
                                memmove(cbuf, ptr, len - (ptr - cbuf));
@@ -2334,7 +2334,7 @@ static int cf_section_read(char const *filename, int *lineno, FILE *fp,
                        if (at_eof) break;
 
                        ptr = buf;
-                       while (*ptr && isspace((int) *ptr)) ptr++;
+                       while (*ptr && isspace((uint8_t) *ptr)) ptr++;
 
                        if (!*ptr || (*ptr == '#')) continue;
 
@@ -2524,8 +2524,8 @@ static int cf_section_read(char const *filename, int *lineno, FILE *fp,
                                         *      Check for valid characters
                                         */
                                        for (p = dp->d_name; *p != '\0'; p++) {
-                                               if (isalpha((int)*p) ||
-                                                   isdigit((int)*p) ||
+                                               if (isalpha((uint8_t)*p) ||
+                                                   isdigit((uint8_t)*p) ||
                                                    (*p == '-') ||
                                                    (*p == '_') ||
                                                    (*p == '.')) continue;
@@ -2805,7 +2805,7 @@ static int cf_section_read(char const *filename, int *lineno, FILE *fp,
                case T_OP_EQ:
                case T_OP_SET:
                case T_OP_PREPEND:
-                       while (isspace((int) *ptr)) ptr++;
+                       while (isspace((uint8_t) *ptr)) ptr++;
 
                        /*
                         *      Be a little more forgiving.
@@ -2827,7 +2827,7 @@ static int cf_section_read(char const *filename, int *lineno, FILE *fp,
 
                                t3 = T_BARE_WORD;
                                while (*q && (*q >= ' ') && (*q != ',') &&
-                                      !isspace(*q)) q++;
+                                      !isspace((uint8_t) *q)) q++;
 
                                if ((size_t) (q - ptr) >= sizeof(buf3)) {
                                        ERROR("%s[%d]: Parse error: value too long",
@@ -2898,7 +2898,7 @@ static int cf_section_read(char const *filename, int *lineno, FILE *fp,
                        /*
                         *      Require a comma, unless there's a comment.
                         */
-                       while (isspace(*ptr)) ptr++;
+                       while (isspace((uint8_t) *ptr)) ptr++;
 
                        if (*ptr == ',') {
                                ptr++;
@@ -2971,7 +2971,7 @@ static int cf_section_read(char const *filename, int *lineno, FILE *fp,
                /*
                 *      Done parsing one thing.  Skip to EOL if possible.
                 */
-               while (isspace(*ptr)) ptr++;
+               while (isspace((uint8_t) *ptr)) ptr++;
 
                if (*ptr == '#') continue;
 
index ba214a26ffc9e8a53fc1cf4000be58ed527b5bc2..c8585b67e0e0940e4bc328d425d7b2ca4d5941ad 100644 (file)
@@ -61,7 +61,7 @@ static bool all_digits(char const *string)
 
        if (*p == '-') p++;
 
-       while (isdigit((int) *p)) p++;
+       while (isdigit((uint8_t) *p)) p++;
 
        return (*p == '\0');
 }
index e5ae41df66e4bc07bd8b72636e32730e2f4cfe49..67243f79ef62e3dda003677ba2b6fef173a14489 100644 (file)
@@ -152,8 +152,8 @@ pid_t radius_start_program(char const *cmd, REQUEST *request, bool exec_wait,
                                for (p = buffer; *p != '='; p++) {
                                        if (*p == '-') {
                                                *p = '_';
-                                       } else if (isalpha((int) *p)) {
-                                               *p = toupper(*p);
+                                       } else if (isalpha((uint8_t) *p)) {
+                                               *p = toupper((uint8_t) *p);
                                        }
                                }
                        }
index f191393357214584ff3c3d84f7ef64aa85c880ee..25b6f0dc7baf36d511b5fd552587b31e3c01a79d 100644 (file)
@@ -130,7 +130,7 @@ int pairlist_read(TALLOC_CTX *ctx, char const *file, PAIR_LIST **list, int compl
                 *      ignore it.
                 */
                ptr = buffer;
-               while (isspace((int) *ptr)) ptr++;
+               while (isspace((uint8_t) *ptr)) ptr++;
 
                if (*ptr == '#' || *ptr == '\n' || !*ptr) continue;
 
@@ -139,7 +139,7 @@ parse_again:
                        /*
                         *      The user's name MUST be the first text on the line.
                         */
-                       if (isspace((int) buffer[0]))  {
+                       if (isspace((uint8_t) buffer[0]))  {
                                ERROR("%s[%d]: Entry does not begin with a user name",
                                      file, lineno);
                                fclose(fp);
@@ -158,7 +158,7 @@ parse_again:
                         *      $INCLUDE filename
                         */
                        if (strcasecmp(entry, "$INCLUDE") == 0) {
-                               while (isspace((int) *ptr)) ptr++;
+                               while (isspace((uint8_t) *ptr)) ptr++;
 
                                /*
                                 *      If it's an absolute pathname,
@@ -261,7 +261,7 @@ parse_again:
                 *      We COULD have a reply, OR we could have a new entry.
                 */
                if (mode == FIND_MODE_WANT_REPLY) {
-                       if (!isspace((int) buffer[0])) goto create_entry;
+                       if (!isspace((uint8_t) buffer[0])) goto create_entry;
 
                        mode = FIND_MODE_HAVE_REPLY;
                }
@@ -274,7 +274,7 @@ parse_again:
                 *      The previous line ended with a comma, and then
                 *      we have the start of a new entry!
                 */
-               if (!isspace((int) buffer[0])) {
+               if (!isspace((uint8_t) buffer[0])) {
                trailing_comma:
                        pairlist_free(&pl);
                        talloc_free(check_tmp);
@@ -335,7 +335,7 @@ parse_again:
                 */
                mode = FIND_MODE_NAME;
                if (feof(fp)) break;
-               if (!isspace((int) buffer[0])) goto parse_again;
+               if (!isspace((uint8_t) buffer[0])) goto parse_again;
        }
 
        /*
index 17988d27f9d8208dc224d6fd3f413725c21a8998..500615d2aff9f0ec4e1e6dd7a344362b0ff0f667 100644 (file)
@@ -87,7 +87,7 @@ bool map_cast_from_hex(vp_map_t *map, FR_TOKEN rhs_type, char const *rhs)
         *      string, go parse it as that.
         */
        if (rhs_type != T_BARE_WORD) return false;
-       if ((rhs[0] != '0') || (tolower((int)rhs[1]) != 'x')) return false;
+       if ((rhs[0] != '0') || (tolower((uint8_t)rhs[1]) != 'x')) return false;
        if (!rhs[2]) return false;
 
        len = strlen(rhs + 2);
index 7bafa8c70b2ab89fae50f4943b8984e5b4e48e36..e337b94fc12dc456df45049d238e220869d94c7a 100644 (file)
@@ -303,7 +303,7 @@ static ssize_t condition_tokenize_word(TALLOC_CTX *ctx, char const *start, char
                /*
                 *      Spaces or special characters delineate the word
                 */
-               if (isspace((int) *p) || (*p == '&') || (*p == '|') ||
+               if (isspace((uint8_t) *p) || (*p == '&') || (*p == '|') ||
                    (*p == '!') || (*p == '=') || (*p == '<') || (*p == '>')) {
                        break;
                }
@@ -335,7 +335,7 @@ static ssize_t condition_tokenize_cast(char const *start, DICT_ATTR const **pda,
        char const *q;
        PW_TYPE cast;
 
-       while (isspace((int) *p)) p++; /* skip spaces before condition */
+       while (isspace((uint8_t) *p)) p++; /* skip spaces before condition */
 
        if (*p != '<') return 0;
        p++;
@@ -378,7 +378,7 @@ static ssize_t condition_tokenize_cast(char const *start, DICT_ATTR const **pda,
 
        q++;
 
-       while (isspace((int) *q)) q++; /* skip spaces after cast */
+       while (isspace((uint8_t) *q)) q++; /* skip spaces after cast */
 
        return q - start;
 }
@@ -503,7 +503,7 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st
        lhs = rhs = NULL;
        lhs_type = rhs_type = T_INVALID;
 
-       while (isspace((int) *p)) p++; /* skip spaces before condition */
+       while (isspace((uint8_t) *p)) p++; /* skip spaces before condition */
 
        if (!*p) {
                return_P("Empty condition is invalid");
@@ -515,7 +515,7 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st
        if (*p == '!') {
                p++;
                c->negate = true;
-               while (isspace((int) *p)) p++; /* skip spaces after negation */
+               while (isspace((uint8_t) *p)) p++; /* skip spaces after negation */
 
                /*
                 *  Just for stupidity
@@ -547,7 +547,7 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st
                }
 
                p += slen;
-               while (isspace((int) *p)) p++; /* skip spaces after (COND)*/
+               while (isspace((uint8_t) *p)) p++; /* skip spaces after (COND)*/
 
        } else { /* it's a bare FOO==BAR */
                /*
@@ -597,7 +597,7 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st
                        c->cast = dict_attrbyvalue(PW_CAST_BASE + PW_TYPE_OCTETS, 0);
                }
 
-               while (isspace((int)*p)) p++; /* skip spaces after LHS */
+               while (isspace((uint8_t)*p)) p++; /* skip spaces after LHS */
 
                /*
                 *      We may (or not) have an operator
@@ -745,7 +745,7 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st
                                break;
                        }
 
-                       while (isspace((int) *p)) p++; /* skip spaces after operator */
+                       while (isspace((uint8_t) *p)) p++; /* skip spaces after operator */
 
                        if (!*p) {
                                return_P("Expected text after operator");
@@ -1255,7 +1255,7 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st
                keep_going:
                        p += slen;
 
-                       while (isspace((int) *p)) p++; /* skip spaces after RHS */
+                       while (isspace((uint8_t) *p)) p++; /* skip spaces after RHS */
                } /* parse OP RHS */
        } /* parse a condition (COND) or FOO OP BAR*/
 
@@ -1268,7 +1268,7 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st
                }
 
                p++;
-               while (isspace((int) *p)) p++; /* skip spaces after closing brace */
+               while (isspace((uint8_t) *p)) p++; /* skip spaces after closing brace */
                goto done;
        }
 
@@ -1622,7 +1622,7 @@ done:
                                for (q = c->data.vpt->name;
                                     *q != '\0';
                                     q++) {
-                                       if (!isdigit((int) *q)) {
+                                       if (!isdigit((uint8_t) *q)) {
                                                break;
                                        }
                                        if (*q != '0') zeros = false;
index cf0809c863f603f7266da3ab7bb9be494e4546f7..57892751ae51f2e3d4de5890865e36c53fc12dab 100644 (file)
@@ -172,7 +172,7 @@ static int encode_data_tlv(char *buffer, char **endptr,
        *p = '\0';
 
        p = buffer + 1;
-       while (isspace((int) *p)) p++;
+       while (isspace((uint8_t) *p)) p++;
 
        length = encode_tlv(p, output, outlen);
        if (length == 0) return 0;
@@ -186,12 +186,12 @@ static int encode_hex(char *p, uint8_t *output, size_t outlen)
        while (*p) {
                char *c1, *c2;
 
-               while (isspace((int) *p)) p++;
+               while (isspace((uint8_t) *p)) p++;
 
                if (!*p) break;
 
-               if(!(c1 = memchr(hextab, tolower((int) p[0]), 16)) ||
-                  !(c2 = memchr(hextab, tolower((int)  p[1]), 16))) {
+               if(!(c1 = memchr(hextab, tolower((uint8_t) p[0]), 16)) ||
+                  !(c2 = memchr(hextab, tolower((uint8_t)  p[1]), 16))) {
                        fprintf(stderr, "Invalid data starting at "
                                "\"%s\"\n", p);
                        return 0;
@@ -217,13 +217,13 @@ static int encode_data(char *p, uint8_t *output, size_t outlen)
 {
        int length;
 
-       if (!isspace((int) *p)) {
+       if (!isspace((uint8_t) *p)) {
                fprintf(stderr, "Invalid character following attribute "
                        "definition\n");
                return 0;
        }
 
-       while (isspace((int) *p)) p++;
+       while (isspace((uint8_t) *p)) p++;
 
        if (*p == '{') {
                int sublen;
@@ -232,7 +232,7 @@ static int encode_data(char *p, uint8_t *output, size_t outlen)
                length = 0;
 
                do {
-                       while (isspace((int) *p)) p++;
+                       while (isspace((uint8_t) *p)) p++;
                        if (!*p) {
                                if (length == 0) {
                                        fprintf(stderr, "No data\n");
@@ -642,7 +642,7 @@ static void process_file(const char *root_dir, char const *filename)
                          ((p > buffer) && (p[-1] != '[')))) *p = '\0';
 
                p = buffer;
-               while (isspace((int) *p)) p++;
+               while (isspace((uint8_t) *p)) p++;
                if (!*p) continue;
 
                DEBUG2("%s[%d]: %s\n", filename, lineno, buffer);
@@ -922,7 +922,7 @@ static void process_file(const char *root_dir, char const *filename)
                        char *q;
 
                        p += 9;
-                       while (isspace((int) *p)) p++;
+                       while (isspace((uint8_t) *p)) p++;
 
                        q = strrchr(directory, '/');
                        if (q) {
index 09d27c8711898d81c5c1916e4cc5c30c06d305f8..37bd406c4afcd527f27ca61112462be06e249f98 100644 (file)
@@ -1253,7 +1253,7 @@ int main(int argc, char **argv)
                        break;
 
                case 'c':
-                       if (!isdigit((int) *optarg)) usage();
+                       if (!isdigit((uint8_t) *optarg)) usage();
 
                        resend_count = atoi(optarg);
 
@@ -1332,7 +1332,7 @@ int main(int argc, char **argv)
                        break;
 
                case 'r':
-                       if (!isdigit((int) *optarg)) usage();
+                       if (!isdigit((uint8_t) *optarg)) usage();
                        retries = atoi(optarg);
                        if ((retries == 0) || (retries > 1000)) usage();
                        break;
@@ -1372,7 +1372,7 @@ int main(int argc, char **argv)
                       break;
 
                case 't':
-                       if (!isdigit((int) *optarg))
+                       if (!isdigit((uint8_t) *optarg))
                                usage();
                        timeout = atof(optarg);
                        break;
@@ -1419,7 +1419,7 @@ int main(int argc, char **argv)
        /*
         *      Get the request type
         */
-       if (!isdigit((int) argv[2][0])) {
+       if (!isdigit((uint8_t) argv[2][0])) {
                packet_code = fr_str2int(request_types, argv[2], -2);
                if (packet_code == -2) {
                        ERROR("Unrecognised request type \"%s\"", argv[2]);
index ea2cf6d7420ed6bc5019f23e505419aae04e44d6..2646796b1e2d4c207fcd5130f973f4c8477158bf 100644 (file)
@@ -375,7 +375,7 @@ static ssize_t xlat_home_server_dynamic(UNUSED void *instance, REQUEST *request,
        }
 
        p = fmt;
-       while (isspace((int) *p)) p++;
+       while (isspace((uint8_t) *p)) p++;
 
        /*
         *      Allow for dynamic strings as arguments.
@@ -2522,8 +2522,8 @@ int realms_init(CONF_SECTION *config)
                         *      Check for valid characters
                         */
                        for (p = dp->d_name; *p != '\0'; p++) {
-                               if (isalpha((int)*p) ||
-                                   isdigit((int)*p) ||
+                               if (isalpha((uint8_t)*p) ||
+                                   isdigit((uint8_t)*p) ||
                                    (*p == '-') ||
                                    (*p == '_') ||
                                    (*p == '.')) continue;
index c67148cf12c7977d77b1f694d5ec2dd09873550c..d7d8ece77e93e6a099d3824b958fefae5e70cc9a 100644 (file)
@@ -365,7 +365,7 @@ static bool identity_is_safe(const char *identity)
        if (!identity) return true;
 
        while ((c = *(identity++)) != '\0') {
-               if (isalpha((int) c) || isdigit((int) c) || isspace((int) c) ||
+               if (isalpha((uint8_t) c) || isdigit((uint8_t) c) || isspace((uint8_t) c) ||
                    (c == '@') || (c == '-') || (c == '_') || (c == '.')) {
                        continue;
                }
index abcd7687f12df54427a3b1aeb85f7bc057d366a3..6ec25987ba8470e555cb7dea7456c2c9e71eae10 100644 (file)
@@ -153,8 +153,8 @@ size_t radius_list_name(pair_lists_t *out, char const *name, pair_lists_t def)
        {
                char const *d = q + 1;
 
-               if (isdigit((int) *d)) {
-                       while (isdigit((int) *d)) d++;
+               if (isdigit((uint8_t) *d)) {
+                       while (isdigit((uint8_t) *d)) d++;
 
                        /*
                         *      Char after the number string
index 50935c989e0e36f61a79a25f6996d9c783e4a273..5a15ee2e5773217555ea82efa8ce87623a0459a3 100644 (file)
@@ -552,7 +552,7 @@ static bool do_xlats(char const *filename, FILE *fp)
                 *      Ignore blank lines and comments
                 */
                p = input;
-               while (isspace((int) *p)) p++;
+               while (isspace((uint8_t) *p)) p++;
 
                if (*p < ' ') continue;
                if (*p == '#') continue;
index 583686a7db496d857219977af94c6e21449a758d..8000aa15258aaf47cfe29c773c33d520575832a4 100644 (file)
@@ -102,7 +102,7 @@ static ssize_t xlat_concat(UNUSED void *instance, REQUEST *request,
        char const *concat;
        char buffer[2];
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        slen = tmpl_from_attr_substr(&vpt, fmt,  REQUEST_CURRENT, PAIR_LIST_REQUEST, false, false);
        if (slen <= 0) {
@@ -111,7 +111,7 @@ static ssize_t xlat_concat(UNUSED void *instance, REQUEST *request,
        }
 
        fmt += slen;
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if (!*fmt) {
                concat = ",";
@@ -148,7 +148,7 @@ static ssize_t xlat_length(UNUSED void *instance, REQUEST *request,
                           char const *fmt, char *out, size_t outlen)
 {
        VALUE_PAIR *vp;
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if ((radius_get_vp(&vp, request, fmt) < 0) || !vp) {
                *out = '\0';
@@ -170,7 +170,7 @@ static ssize_t xlat_integer(UNUSED void *instance, REQUEST *request,
        uint64_t        int64 = 0;      /* Needs to be initialised to zero */
        uint32_t        int32 = 0;      /* Needs to be initialised to zero */
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if ((radius_get_vp(&vp, request, fmt) < 0) || !vp) {
                *out = '\0';
@@ -259,7 +259,7 @@ static ssize_t xlat_hex(UNUSED void *instance, REQUEST *request,
        value_data_t dst;
        uint8_t const *buff = NULL;
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if ((radius_get_vp(&vp, request, fmt) < 0) || !vp) {
        error:
@@ -314,7 +314,7 @@ static ssize_t xlat_tag(UNUSED void *instance, REQUEST *request,
 {
        VALUE_PAIR *vp;
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if ((radius_get_vp(&vp, request, fmt) < 0) || !vp) {
                *out = '\0';
@@ -338,7 +338,7 @@ static ssize_t xlat_vendor(UNUSED void *instance, REQUEST *request,
        VALUE_PAIR *vp;
        DICT_VENDOR *vendor;
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if ((radius_get_vp(&vp, request, fmt) < 0) || !vp) {
                *out = '\0';
@@ -363,7 +363,7 @@ static ssize_t xlat_vendor_num(UNUSED void *instance, REQUEST *request,
 {
        VALUE_PAIR *vp;
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if ((radius_get_vp(&vp, request, fmt) < 0) || !vp) {
                *out = '\0';
@@ -381,7 +381,7 @@ static ssize_t xlat_attr(UNUSED void *instance, REQUEST *request,
 {
        VALUE_PAIR *vp;
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if ((radius_get_vp(&vp, request, fmt) < 0) || !vp) {
                *out = '\0';
@@ -400,7 +400,7 @@ static ssize_t xlat_attr_num(UNUSED void *instance, REQUEST *request,
 {
        VALUE_PAIR *vp;
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if ((radius_get_vp(&vp, request, fmt) < 0) || !vp) {
                *out = '\0';
@@ -433,7 +433,7 @@ static ssize_t xlat_debug_attr(UNUSED void *instance, REQUEST *request, char con
                return -1;
        }
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if (tmpl_from_attr_str(&vpt, fmt, REQUEST_CURRENT, PAIR_LIST_REQUEST, false, false) <= 0) {
                RDEBUG("%s", fr_strerror());
@@ -644,7 +644,7 @@ static ssize_t xlat_string(UNUSED void *instance, REQUEST *request,
        VALUE_PAIR *vp;
        uint8_t const *p;
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if (outlen < 3) {
        nothing:
@@ -688,7 +688,7 @@ static ssize_t xlat_xlat(UNUSED void *instance, REQUEST *request,
 {
        VALUE_PAIR *vp;
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if (outlen < 3) {
        nothing:
@@ -1147,7 +1147,7 @@ ssize_t xlat_fmt_to_ref(uint8_t const **out, REQUEST *request, char const *fmt)
 {
        VALUE_PAIR *vp;
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if (fmt[0] == '&') {
                if ((radius_get_vp(&vp, request, fmt) < 0) || !vp) {
@@ -1317,7 +1317,7 @@ static ssize_t xlat_tokenize_expansion(TALLOC_CTX *ctx, char *fmt, xlat_exp_t **
        for (q = p; *q != '\0'; q++) {
                if (*q == ':') break;
 
-               if (isspace((int) *q)) break;
+               if (isspace((uint8_t) *q)) break;
 
                if (*q == '[') continue;
 
index 2ae0a763cb1a983a6c738d1609aedad11ecb1ddf..5ab4365f679224991bbec7589863d7af9212accb 100644 (file)
@@ -459,13 +459,13 @@ int main(int argc, char **argv)
                        break;
 #endif
                case 'r':
-                       if (!isdigit((int) *optarg))
+                       if (!isdigit((uint8_t) *optarg))
                                usage();
                        retries = atoi(optarg);
                        if ((retries == 0) || (retries > 1000)) usage();
                        break;
                case 't':
-                       if (!isdigit((int) *optarg))
+                       if (!isdigit((uint8_t) *optarg))
                                usage();
                        timeout = atof(optarg);
                        break;
@@ -530,7 +530,7 @@ int main(int argc, char **argv)
         *      See what kind of request we want to send.
         */
        if (argc >= 3) {
-               if (!isdigit((int) argv[2][0])) {
+               if (!isdigit((uint8_t) argv[2][0])) {
                        packet_code = fr_str2int(request_types, argv[2], -2);
                        if (packet_code == -2) {
                                fprintf(stderr, "Unknown packet type: %s\n", argv[2]);
index 1cd73ff2469d5f1cac253adedc77037be2a7ae24..b8a740be29266c06162e2f3829d85f1eb59fc2e1 100644 (file)
@@ -57,7 +57,7 @@ static ssize_t dhcp_options_xlat(UNUSED void *instance, REQUEST *request,
        int             decoded = 0;
        ssize_t         slen;
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        slen = tmpl_from_attr_str(&src, fmt, REQUEST_CURRENT, PAIR_LIST_REQUEST, false, false);
        if (slen <= 0) {
@@ -116,7 +116,7 @@ static ssize_t dhcp_xlat(UNUSED void *instance, REQUEST *request, char const *fm
        uint8_t *p = binbuf, *end = p + sizeof(binbuf);
        ssize_t slen;
 
-       while (isspace((int) *fmt)) fmt++;
+       while (isspace((uint8_t) *fmt)) fmt++;
 
        if ((radius_copy_vp(request, &head, request, fmt) < 0) || !head) {
                 *out = '\0';
index 7f19824dd301d215decf7fad2185f45103efad41..ff46aef0c327708efe9fa164ae87794d03aa3b28 100644 (file)
@@ -271,12 +271,12 @@ static int find_next_reset(rlm_counter_t *inst, time_t timeval)
 
        if (!inst->reset)
                return -1;
-       if (isdigit((int) inst->reset[0])) {
+       if (isdigit((uint8_t) inst->reset[0])) {
                len = strlen(inst->reset);
                if (len == 0)
                        return -1;
                last = inst->reset[len - 1];
-               if (!isalpha((int) last))
+               if (!isalpha((uint8_t) last))
                        last = 'd';
                num = atoi(inst->reset);
                DEBUG("rlm_counter: num=%d, last=%c",num,last);
index f0452b43f4f887e9872363cfa6df53c25359b207..1ece323072c7b2bdb615885fa5a5c4179cee25bb 100644 (file)
@@ -118,7 +118,7 @@ int eap_module_instantiate(rlm_eap_t *inst, eap_module_t **m_inst, eap_type_t nu
         */
        p = mod_name;
        while (*p) {
-               *p = tolower(*p);
+               *p = tolower((uint8_t) *p);
                p++;
        }
 
index cd504a8363f8ff6cbab9763667e0e31246cf976b..955df1eae030110520222c084ed4bbe8ac41766f 100644 (file)
@@ -1959,7 +1959,7 @@ int main(int argc, char **argv)
                  break;
 
                case 'r':
-                       if (!isdigit((int) *optarg))
+                       if (!isdigit((uint8_t) *optarg))
                                usage();
                        retries = atoi(optarg);
                        break;
@@ -1967,7 +1967,7 @@ int main(int argc, char **argv)
                        do_summary = 1;
                        break;
                case 't':
-                       if (!isdigit((int) *optarg))
+                       if (!isdigit((uint8_t) *optarg))
                                usage();
                        timeout = atof(optarg);
                        break;
@@ -2059,7 +2059,7 @@ int main(int argc, char **argv)
        /*
         *      Get the request type
         */
-       if (!isdigit((int) argv[2][0])) {
+       if (!isdigit((uint8_t) argv[2][0])) {
                packet_code = fr_str2int(rc_request_types, argv[2], -2);
                if (packet_code == -2) {
                        ERROR("Unrecognised request type \"%s\"\n", argv[2]);
index f83580037641a3df790cca2b9e97f241bf13f7b3..a3bf1b4d6a131f9c7c5788cde2e9e9ad545c5fd4 100644 (file)
@@ -201,7 +201,7 @@ static bool get_number(REQUEST *request, char const **string, int64_t *answer)
        /*
         *      Look for a number.
         */
-       while (isspace((int) *p)) p++;
+       while (isspace((uint8_t) *p)) p++;
 
        /*
         *      ~1 == 0xff...ffe
@@ -296,7 +296,7 @@ static bool get_number(REQUEST *request, char const **string, int64_t *answer)
                goto done;
        }
 
-       while (isspace((int) *p)) p++;
+       while (isspace((uint8_t) *p)) p++;
 
        if ((*p < '0') || (*p > '9')) {
                RDEBUG2("Not a number at \"%s\"", p);
@@ -446,7 +446,7 @@ static bool get_expression(REQUEST *request, char const **string, int64_t *answe
        if (!get_number(request, &p, &lhs)) return false;
 
 redo:
-       while (isspace((int) *p)) p++;
+       while (isspace((uint8_t) *p)) p++;
 
        /*
         *      A number by itself is OK.
@@ -572,7 +572,7 @@ static ssize_t randstr_xlat(UNUSED void *instance, UNUSED REQUEST *request,
                 *      But we limit it to 100, because we don't want
                 *      utter stupidity.
                 */
-               while (isdigit((int) *p)) {
+               while (isdigit((uint8_t) *p)) {
                        if (number >= 100) {
                                p++;
                                continue;
@@ -763,8 +763,8 @@ static ssize_t urlunquote_xlat(UNUSED void *instance, REQUEST *request,
                /* Is a % char */
 
                /* Don't need \0 check, as it won't be in the hextab */
-               if (!(c1 = memchr(hextab, tolower(*++p), 16)) ||
-                   !(c2 = memchr(hextab, tolower(*++p), 16))) {
+               if (!(c1 = memchr(hextab, tolower((uint8_t) *++p), 16)) ||
+                   !(c2 = memchr(hextab, tolower((uint8_t) *++p), 16))) {
                        REMARKER(fmt, p - fmt, "None hex char in % sequence");
                        return -1;
                }
@@ -866,8 +866,8 @@ static ssize_t unescape_xlat(UNUSED void *instance, UNUSED REQUEST *request,
 
                /* Is a = char */
 
-               if (!(c1 = memchr(hextab, tolower(*(p + 1)), 16)) ||
-                   !(c2 = memchr(hextab, tolower(*(p + 2)), 16))) goto next;
+               if (!(c1 = memchr(hextab, tolower((uint8_t) *(p + 1)), 16)) ||
+                   !(c2 = memchr(hextab, tolower((uint8_t) *(p + 2)), 16))) goto next;
                c3 = ((c1 - hextab) << 4) + (c2 - hextab);
 
                *out++ = c3;
@@ -895,7 +895,7 @@ static ssize_t tolower_xlat(UNUSED void *instance, UNUSED REQUEST *request, char
        for (p = fmt, q = out; *p != '\0'; p++, outlen--) {
                if (outlen <= 1) break;
 
-               *(q++) = tolower((int) *p);
+               *(q++) = tolower((uint8_t) *p);
        }
 
        *q = '\0';
@@ -919,7 +919,7 @@ static ssize_t toupper_xlat(UNUSED void *instance, UNUSED REQUEST *request, char
        for (p = fmt, q = out; *p != '\0'; p++, outlen--) {
                if (outlen <= 1) break;
 
-               *(q++) = toupper((int) *p);
+               *(q++) = toupper((uint8_t) *p);
        }
 
        *q = '\0';
@@ -1149,7 +1149,7 @@ static ssize_t hmac_md5_xlat(UNUSED void *instance, REQUEST *request,
        data_len = xlat_fmt_to_ref(&data, request, data_ref);
        if (data_len < 0) return -1;
 
-       while (isspace(*p) && p++);
+       while (isspace((uint8_t) *p) && p++);
 
        key_len = xlat_fmt_to_ref(&key, request, p);
        if (key_len < 0) return -1;
@@ -1195,7 +1195,7 @@ static ssize_t hmac_sha1_xlat(UNUSED void *instance, REQUEST *request,
        data_len = xlat_fmt_to_ref(&data, request, data_ref);
        if (data_len < 0) return -1;
 
-       while (isspace(*p) && p++);
+       while (isspace((uint8_t) *p) && p++);
 
        key_len = xlat_fmt_to_ref(&key, request, p);
        if (key_len < 0) return -1;
@@ -1425,7 +1425,7 @@ static ssize_t explode_xlat(UNUSED void *instance, REQUEST *request,
        /*
         *  Trim whitespace
         */
-       while (isspace(*p) && p++);
+       while (isspace((uint8_t) *p) && p++);
 
        slen = tmpl_from_attr_substr(&vpt, p, REQUEST_CURRENT, PAIR_LIST_REQUEST, false, false);
        if (slen <= 0) {
@@ -1700,7 +1700,7 @@ static bool parse_pad(REQUEST *request, char const *fmt,
        *fill = ' ';            /* the default */
 
        p = fmt;
-       while (isspace((int) *p)) p++;
+       while (isspace((uint8_t) *p)) p++;
 
        if (*p != '&') {
                RDEBUG("First argument must be an attribute reference");
@@ -1719,7 +1719,7 @@ static bool parse_pad(REQUEST *request, char const *fmt,
 
        p = fmt + slen;
 
-       while (isspace((int) *p)) p++;
+       while (isspace((uint8_t) *p)) p++;
 
        length = strtoul(p, &end, 10);
        if ((length == ULONG_MAX) || (length > 8192)) {
@@ -1737,13 +1737,13 @@ static bool parse_pad(REQUEST *request, char const *fmt,
         *      and we must have only ONE fill character.
         */
        if (*p) {
-               if (!isspace(*p)) {
+               if (!isspace((uint8_t) *p)) {
                        talloc_free(vpt);
                        RDEBUG("Invalid text found at: %s", p);
                        return false;
                }
 
-               while (isspace((int) *p)) p++;
+               while (isspace((uint8_t) *p)) p++;
 
                if (p[1] != '\0') {
                        talloc_free(vpt);
index af4954de5d87ee4ff624f853b3c2543e80a08961..9cf99d832ebd7e87d49398c29ee26bb857a9c092 100644 (file)
@@ -102,11 +102,11 @@ static ssize_t json_encode_xlat(UNUSED void * instance, REQUEST *request, char c
 
        p = fmt;
 
-       while (isspace((int) *p)) p++;
+       while (isspace((uint8_t) *p)) p++;
        if (*p == '\0') return -1;
 
        while (*p) {
-               while (isspace((int) *p)) p++;
+               while (isspace((uint8_t) *p)) p++;
 
                if (*p == '\0') break;
 
@@ -164,7 +164,7 @@ static ssize_t json_encode_xlat(UNUSED void * instance, REQUEST *request, char c
                /* Jump forward to next attr */
                p += slen;
 
-               if (*p != '\0' && !isspace((int)*p)) {
+               if (*p != '\0' && !isspace((uint8_t)*p)) {
                        REMARKER(fmt, (p - fmt), "Missing whitespace");
                        goto error;
                }
index 33e5a885caa8dfd4069692b4b1ae8627f4592c25..1d36a837cfb150c64f83ca999b6527dca45a571f 100644 (file)
@@ -827,7 +827,7 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance)
                        case ',':
                        case ';':
                        case ' ':
-                               while (isspace((int) *p)) p++;
+                               while (isspace((uint8_t) *p)) p++;
                                if (p == q) continue;
 
                                buff = talloc_array(inst, char, (q - p) + 1);
index a1fffc6674ef528a639418b6b61c3681724b25b8..1cd827a16ca705d128f76329735d192be9cb8e9d 100644 (file)
@@ -85,7 +85,7 @@ static int hour_fill(char *bitmap, char const *tm)
        end = -1;
        if ((p = strchr(tm, '-')) != NULL) {
                p++;
-               if (p - tm != 5 || strlen(p) < 4 || !isdigit((int) *p))
+               if (p - tm != 5 || strlen(p) < 4 || !isdigit((uint8_t) *p))
                        return 0;
                end = 600 * val(p[0]) + 60 * val(p[1]) + atoi(p + 2);
        }
@@ -93,7 +93,7 @@ static int hour_fill(char *bitmap, char const *tm)
                start = 0;
                end = DAYMIN - 1;
        } else {
-               if (strlen(tm) < 4 || !isdigit((int) *tm))
+               if (strlen(tm) < 4 || !isdigit((uint8_t) *tm))
                        return 0;
                start = 600 * val(tm[0]) + 60 * val(tm[1]) + atoi(tm + 2);
                if (end < 0) end = start;
@@ -132,7 +132,7 @@ static int day_fill(char *bitmap, char const *tm)
        int start, end;
 
        for (hr = tm; *hr; hr++)
-               if (isdigit((int) *hr))
+               if (isdigit((uint8_t) *hr))
                        break;
        if (hr == tm)
                tm = "Al";
@@ -181,7 +181,7 @@ static int week_fill(char *bitmap, char const *tm)
 
        strlcpy(tmp, tm, sizeof(tmp));
        for (s = tmp; *s; s++)
-               if (isupper(*s)) *s = tolower(*s);
+               if (isupper((uint8_t) *s)) *s = tolower((uint8_t) *s);
 
        s = strtok(tmp, ",|");
        while (s) {
index 25bcd9c44e94039b7c3ed57da5066e19e3a80640..00ab90d994fddd9475ababb03069ba65507e5627 100644 (file)
@@ -489,7 +489,7 @@ static ssize_t mschap_xlat(void *instance, REQUEST *request,
                if ((*p == '\0') || (outlen <= 32))
                        return 0;
 
-               while (isspace(*p)) p++;
+               while (isspace((uint8_t) *p)) p++;
 
                if (mschap_ntpwdhash(buffer, p) < 0) {
                        REDEBUG("Failed generating NT-Password");
@@ -512,7 +512,7 @@ static ssize_t mschap_xlat(void *instance, REQUEST *request,
                if ((*p == '\0') || (outlen <= 32))
                        return 0;
 
-               while (isspace(*p)) p++;
+               while (isspace((uint8_t) *p)) p++;
 
                smbdes_lmpwdhash(p, buffer);
                fr_bin2hex(out, buffer, LM_DIGEST_LENGTH);
index 12e75a0000a9a4b8c912aeaa2065d83449d5d3a8..d80de343c3beffdcc14d13419d5439d8de0c5b89 100644 (file)
@@ -323,7 +323,7 @@ void smbdes_lmpwdhash(char const *password, uint8_t *lmhash)
 
        memset(p14, 0, sizeof(p14));
        for (i = 0; i < 14 && password[i]; i++) {
-               p14[i] = toupper((int) password[i]);
+               p14[i] = toupper((uint8_t) password[i]);
        }
 
        smbhash(lmhash, sp8, p14);
index fcb3fd11fcedc0725ecc6280780867baa37c0421..e43785f9a789d0af4502f6c2252e624c1510c642 100644 (file)
@@ -1099,7 +1099,7 @@ static int rest_decode_post(UNUSED rlm_rest_t *instance, UNUSED rlm_rest_section
        /*
         *      Empty response?
         */
-       while (isspace(*p)) p++;
+       while (isspace((uint8_t) *p)) p++;
        if (*p == '\0') return 0;
 
        while (((q = strchr(p, '=')) != NULL) && (count < REST_BODY_MAX_ATTRS)) {
@@ -1563,7 +1563,7 @@ static int rest_decode_json(rlm_rest_t *instance, rlm_rest_section_t *section,
        /*
         *  Empty response?
         */
-       while (isspace(*p)) p++;
+       while (isspace((uint8_t) *p)) p++;
        if (*p == '\0') return 0;
 
        json = json_tokener_parse(p);
index 1337ae5425947926d3719b1520e3a7c7f8872202..72286b71e6782a1dd8dcf561c17297444fb51c46 100644 (file)
@@ -254,7 +254,7 @@ static ssize_t rest_xlat(void *instance, REQUEST *request,
        /*
         *  Trim whitespace
         */
-       while (isspace(*p) && p++);
+       while (isspace((uint8_t) *p) && p++);
 
        /*
         *  Unescape parts of xlat'd URI, this allows REST servers to be specified by
index a45dd654738308df738eb41a8c1b3adaa6217eee..f40f18af3ce808ffa8166d3c1cb4fbc43e795944 100644 (file)
@@ -243,7 +243,7 @@ static CC_HINT(nonnull) sql_rcode_t sql_query(rlm_sql_handle_t *handle, rlm_sql_
         *      We parse the string to see what's up.
         */
        p = query;
-       while (isspace((int) *p)) p++;
+       while (isspace((uint8_t) *p)) p++;
 
        if (strncmp(p, "db.", 3) != 0) {
                ERROR("rlm_sql_mongo: Invalid query - must start with 'db.'");
@@ -284,9 +284,9 @@ static CC_HINT(nonnull) sql_rcode_t sql_query(rlm_sql_handle_t *handle, rlm_sql_
                 *      Allow whitespace after the command name, and
                 *      before the bracket.
                 */
-               if (isspace((int) *p)) {
+               if (isspace((uint8_t) *p)) {
                        *ptr = '\0';
-                       while (*p && isspace((int) *p)) p++;
+                       while (*p && isspace((uint8_t) *p)) p++;
 
                        if (*p != '(') {
                                ERROR("rlm_sql_mongo: Invalid query - no starting '('");
index e720c8e7aa0158a69399f44bd0b180907d54f9e5..f0da7aa3e539dbc0525b92f1df2b90580b03b900 100644 (file)
@@ -315,7 +315,7 @@ static int mod_bootstrap(CONF_SECTION *conf, void *instance)
                return -1;
        }
 
-       while (isspace((int) *p)) p++;
+       while (isspace((uint8_t) *p)) p++;
 
        if ((strncasecmp(p, "insert", 6) == 0) ||
            (strncasecmp(p, "update", 6) == 0) ||
index 26aded7a7c58e6790271bb30e867801a81f4ab79..5987ae62636e90edcb3d8a2b7de2e57a4b11e952 100644 (file)
@@ -124,12 +124,12 @@ static int find_next_reset(rlm_sqlcounter_t *inst, REQUEST *request, time_t time
        /*
         *      Reset every N hours, days, weeks, months.
         */
-       if (isdigit((int) inst->reset[0])){
+       if (isdigit((uint8_t) inst->reset[0])){
                len = strlen(inst->reset);
                if (len == 0) return -1;
 
                last = inst->reset[len - 1];
-               if (!isalpha((int) last)) {
+               if (!isalpha((uint8_t) last)) {
                        last = 'd';
                }
 
@@ -212,12 +212,12 @@ static int find_prev_reset(rlm_sqlcounter_t *inst, time_t timeval)
 
        rad_assert(inst->reset != NULL);
 
-       if (isdigit((int) inst->reset[0])){
+       if (isdigit((uint8_t) inst->reset[0])){
                len = strlen(inst->reset);
                if (len == 0)
                        return -1;
                last = inst->reset[len - 1];
-               if (!isalpha((int) last))
+               if (!isalpha((uint8_t) last))
                        last = 'd';
                num = atoi(inst->reset);
                DEBUG("rlm_sqlcounter: num=%d, last=%c",num,last);
index 93979818bae5e8643673d9809a65dca3ff10b68f..dfdc81a80912261172602cfb8f958deb937af8b5 100644 (file)
@@ -58,11 +58,11 @@ static ssize_t unpack_xlat(UNUSED void *instance, REQUEST *request, char const *
        strlcpy(buffer, fmt, sizeof(buffer));
 
        p = buffer;
-       while (isspace((int) *p)) p++; /* skip leading spaces */
+       while (isspace((uint8_t) *p)) p++; /* skip leading spaces */
 
        data_name = p;
 
-       while (*p && !isspace((int) *p)) p++;
+       while (*p && !isspace((uint8_t) *p)) p++;
 
        if (!*p) {
        error:
@@ -72,20 +72,20 @@ static ssize_t unpack_xlat(UNUSED void *instance, REQUEST *request, char const *
                return -1;
        }
 
-       while (isspace((int) *p)) *(p++) = '\0';
+       while (isspace((uint8_t) *p)) *(p++) = '\0';
        if (!*p) GOTO_ERROR;
 
        data_size = p;
 
-       while (*p && !isspace((int) *p)) p++;
+       while (*p && !isspace((uint8_t) *p)) p++;
        if (!*p) GOTO_ERROR;
 
-       while (isspace((int) *p)) *(p++) = '\0';
+       while (isspace((uint8_t) *p)) *(p++) = '\0';
        if (!*p) GOTO_ERROR;
 
        data_type = p;
 
-       while (*p && !isspace((int) *p)) p++;
+       while (*p && !isspace((uint8_t) *p)) p++;
        if (*p) GOTO_ERROR;     /* anything after the type is an error */
 
        /*
@@ -287,7 +287,7 @@ static ssize_t substring_xlat(UNUSED void *instance, REQUEST *request,
        /*
         *  Trim whitespace
         */
-       while (isspace(*p) && p++);
+       while (isspace((uint8_t) *p) && p++);
 
        /*
         * Find numeric parameters at the end.
index 1908e9d28c2fc5222161c80597d2aa32c08f7dbe..83b76558cab621d042f2c7740787dd050a80eaa3 100644 (file)
@@ -88,8 +88,8 @@ static ssize_t modhex2hex(char const *modhex, uint8_t *hex, size_t len)
                if (modhex[(i << 1) + 1] == '\0')
                        return -1;
 
-               if (!(c1 = memchr(modhextab, tolower((int) modhex[i << 1]), 16)) ||
-                   !(c2 = memchr(modhextab, tolower((int) modhex[(i << 1) + 1]), 16)))
+               if (!(c1 = memchr(modhextab, tolower((uint8_t) modhex[i << 1]), 16)) ||
+                   !(c2 = memchr(modhextab, tolower((uint8_t) modhex[(i << 1) + 1]), 16)))
                        return -1;
 
                hex[i] = hextab[c1 - modhextab];