]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Silence compiler warnings found by clang
authorVictor Julien <victor@inliniac.net>
Thu, 15 Nov 2012 15:02:44 +0000 (16:02 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 15 Nov 2012 15:02:44 +0000 (16:02 +0100)
28 files changed:
src/detect-bytejump.c
src/detect-bytetest.c
src/detect-content.c
src/detect-depth.c
src/detect-distance.c
src/detect-engine-address.c
src/detect-engine-iponly.c
src/detect-engine.c
src/detect-flowvar.c
src/detect-ftpbounce.c
src/detect-ipproto.c
src/detect-isdataat.c
src/detect-offset.c
src/detect-parse.c
src/detect-pcre.c
src/detect-pktvar.c
src/detect-tos.c
src/detect-within.c
src/detect.c
src/flow-manager.c
src/suricata.c
src/tm-threads.c
src/util-classification-config.c
src/util-host-os-info.c
src/util-path.c
src/util-privs.c
src/util-reference-config.c
src/util-threshold-config.c

index 90325d6b72a7e8ff570289c3a28292fa48583cbd..68ed674bd49dedfb9771db0bd0fbc9dcc40d3fbf 100644 (file)
@@ -370,15 +370,15 @@ DetectBytejumpData *DetectBytejumpParse(char *optstr, char **offset)
      * and *yes* this *is* ugly.
      */
     end_ptr = str_ptr;
-    while (!(isspace(*end_ptr) || (*end_ptr == ','))) end_ptr++;
+    while (!(isspace((unsigned char)*end_ptr) || (*end_ptr == ','))) end_ptr++;
     *(end_ptr++) = '\0';
     args[0] = str_ptr;
     numargs++;
 
     str_ptr = end_ptr;
-    while (isspace(*str_ptr) || (*str_ptr == ',')) str_ptr++;
+    while (isspace((unsigned char)*str_ptr) || (*str_ptr == ',')) str_ptr++;
     end_ptr = str_ptr;
-    while (!(isspace(*end_ptr) || (*end_ptr == ',')) && (*end_ptr != '\0'))
+    while (!(isspace((unsigned char)*end_ptr) || (*end_ptr == ',')) && (*end_ptr != '\0'))
         end_ptr++;
     *(end_ptr++) = '\0';
     args[1] = str_ptr;
@@ -416,7 +416,7 @@ DetectBytejumpData *DetectBytejumpParse(char *optstr, char **offset)
     }
 
     /* Offset */
-    if (args[1][0] != '-' && isalpha(args[1][0])) {
+    if (args[1][0] != '-' && isalpha((unsigned char)args[1][0])) {
         if (offset == NULL) {
             SCLogError(SC_ERR_INVALID_ARGUMENT, "byte_jump supplied with "
                        "var name for offset.  \"value\" argument supplied to "
index e1c86ba157b34d576c4c7e4bd123606bbaa845d4..50ad805024b0bcc09607ffff5a01041befec0300 100644 (file)
@@ -339,7 +339,7 @@ DetectBytetestData *DetectBytetestParse(char *optstr, char **value, char **offse
     }
 
     /* Value */
-    if (args[3][0] != '-' && isalpha(args[3][0])) {
+    if (args[3][0] != '-' && isalpha((unsigned char)args[3][0])) {
         if (value == NULL) {
             SCLogError(SC_ERR_INVALID_ARGUMENT, "byte_test supplied with "
                        "var name for value.  \"value\" argument supplied to "
@@ -357,7 +357,7 @@ DetectBytetestData *DetectBytetestParse(char *optstr, char **value, char **offse
     }
 
     /* Offset */
-    if (args[4][0] != '-' && isalpha(args[4][0])) {
+    if (args[4][0] != '-' && isalpha((unsigned char)args[4][0])) {
         if (offset == NULL) {
             SCLogError(SC_ERR_INVALID_ARGUMENT, "byte_test supplied with "
                        "var name for offset.  \"offset\" argument supplied to "
index f09c77686c4ed33de75a879e747b77e5b434ffce..606dbcec7ab44504f8b7b7ee92774a70d4d368cd 100644 (file)
@@ -77,7 +77,7 @@ int DetectContentDataParse(char *keyword, char *contentstr, char** pstr, uint16_
     }
 
     /* skip the first spaces */
-    while (pos < slen && isspace(contentstr[pos]))
+    while (pos < slen && isspace((unsigned char)contentstr[pos]))
         pos++;
 
     if (contentstr[pos] == '!') {
@@ -135,7 +135,7 @@ int DetectContentDataParse(char *keyword, char *contentstr, char** pstr, uint16_
                 escape = 1;
             } else {
                 if (bin) {
-                    if (isdigit(str[i]) ||
+                    if (isdigit((unsigned char)str[i]) ||
                             str[i] == 'A' || str[i] == 'a' ||
                             str[i] == 'B' || str[i] == 'b' ||
                             str[i] == 'C' || str[i] == 'c' ||
index c167a301caa94aa63d3e34e7db91fb2890e9fec3..f6ecc46bc2ca2dc5d5cac8218d14ad8afca383b3 100644 (file)
@@ -148,7 +148,7 @@ static int DetectDepthSetup (DetectEngineCtx *de_ctx, Signature *s, char *depths
                 goto error;
             }
 
-            if (str[0] != '-' && isalpha(str[0])) {
+            if (str[0] != '-' && isalpha((unsigned char)str[0])) {
                 SigMatch *bed_sm =
                     DetectByteExtractRetrieveSMVar(str, s,
                                                    SigMatchListSMBelongsTo(s, pm));
index 10afa11b4c8f6e79ce951a1cf7be7ce59c04b245..8c442ceaa4b4d481a5c5b95ded456f09a7e25e60 100644 (file)
@@ -222,7 +222,7 @@ static int DetectDistanceSetup (DetectEngineCtx *de_ctx, Signature *s,
                 goto error;
             }
 
-            if (str[0] != '-' && isalpha(str[0])) {
+            if (str[0] != '-' && isalpha((unsigned char)str[0])) {
                 SigMatch *bed_sm =
                     DetectByteExtractRetrieveSMVar(str, s,
                                                    SigMatchListSMBelongsTo(s, pm));
index 75ed73fce7b484470d44dc28adb504639c01fd6e..fff5c762077e5a9d2729f05b1b7a41564b825bf1 100644 (file)
@@ -644,7 +644,7 @@ int DetectAddressParseString(DetectAddress *dd, char *str)
                 /* 1.2.3.4/24 format */
 
                 for (u = 0; u < strlen(mask); u++) {
-                    if(!isdigit(mask[u]))
+                    if(!isdigit((unsigned char)mask[u]))
                         goto error;
                 }
 
index 563f1919032d92fed057de63d3ea6ce363d714e0..903edc504ae240598b8576f08ea249292bc037a6 100644 (file)
@@ -160,7 +160,7 @@ static int IPOnlyCIDRItemParseSingle(IPOnlyCIDRItem *dd, char *str)
                 /* 1.2.3.4/24 format */
 
                 for (u = 0; u < strlen(mask); u++) {
-                    if(!isdigit(mask[u]))
+                    if(!isdigit((unsigned char)mask[u]))
                         goto error;
                 }
 
index b3310a39a4bee2b2e1ce223e735e477a3bd8869c..ec80abc9e09d1001740eda2285c17c88a23ca3df 100644 (file)
@@ -549,6 +549,7 @@ static void *DetectEngineLiveRuleSwap(void *arg)
     SCLogInfo("===== Live rule swap DONE =====");
 
     pthread_exit(NULL);
+    return NULL;
 }
 
 void DetectEngineSpawnLiveRuleSwapMgmtThread(void)
index 744376817efbb3b1e56fde319b68a6a06b438799..c01ef37019352f9c28b382ffa2d93bbb3ec3c221 100644 (file)
@@ -172,7 +172,7 @@ static int DetectFlowvarSetup (DetectEngineCtx *de_ctx, Signature *s, char *raws
                 }
             } else {
                 if (bin) {
-                    if (isdigit(str[i]) ||
+                    if (isdigit((unsigned char)str[i]) ||
                         str[i] == 'A' || str[i] == 'a' ||
                         str[i] == 'B' || str[i] == 'b' ||
                         str[i] == 'C' || str[i] == 'c' ||
index 80379bc317105648150d7a856937a0cbe0f194e8..ee43e2252a7bae4fc61c954c17183d54e9ef39f8 100644 (file)
@@ -113,10 +113,10 @@ int DetectFtpbounceMatchArgs(uint8_t *payload, uint16_t payload_len,
 
     i = offset;
     /* Search for the first IP octect(Skips "PORT ") */
-    while (i < payload_len && !isdigit(c[i])) i++;
+    while (i < payload_len && !isdigit((unsigned char)c[i])) i++;
 
     for (;i < payload_len && octet_ascii_len < 4 ;i++) {
-        if (isdigit(c[i])) {
+        if (isdigit((unsigned char)c[i])) {
             octet =(c[i] - '0') + octet * 10;
             octet_ascii_len++;
         } else {
@@ -125,8 +125,8 @@ int DetectFtpbounceMatchArgs(uint8_t *payload, uint16_t payload_len,
                 return 0;
             }
 
-            if (isspace(c[i]))
-                while (i < payload_len && isspace(c[i]) ) i++;
+            if (isspace((unsigned char)c[i]))
+                while (i < payload_len && isspace((unsigned char)c[i]) ) i++;
 
             if (i < payload_len && c[i] == ',') { /* we have an octet */
                 noctet++;
index 11e5f5a3e9496ca2958b370a8d832662faf3ff7c..237b2a6aa66d141423e6b29d607a5de1fe122400 100644 (file)
@@ -140,7 +140,7 @@ static DetectIPProtoData *DetectIPProtoParse(const char *optstr)
     }
 
     /* Protocol name/number */
-    if (!isdigit(*(args[1]))) {
+    if (!isdigit((unsigned char)*(args[1]))) {
         struct protoent *pent = getprotobyname(args[1]);
         if (pent == NULL) {
             SCLogError(SC_ERR_INVALID_VALUE, "Malformed protocol name: %s",
index 2a4f59aee0e53cd325cb0cd37b2bd591e2d1fc7e..ef265578885ba4b6c509e4aef8b717229eb49189 100644 (file)
@@ -182,7 +182,7 @@ DetectIsdataatData *DetectIsdataatParse (char *isdataatstr, char **offset)
         idad->flags = 0;
         idad->dataat = 0;
 
-        if (args[0][0] != '-' && isalpha(args[0][0])) {
+        if (args[0][0] != '-' && isalpha((unsigned char)args[0][0])) {
             if (offset == NULL) {
                 SCLogError(SC_ERR_INVALID_ARGUMENT, "isdataat supplied with "
                            "var name for offset.  \"offset\" argument supplied to "
index e5412d7a35fbd3f7963b0d5fcc00d496c6cc6eae..21beeb94daeed838b959adefb090fc77866e851f 100644 (file)
@@ -147,7 +147,7 @@ int DetectOffsetSetup (DetectEngineCtx *de_ctx, Signature *s, char *offsetstr)
                 goto error;
             }
 
-            if (str[0] != '-' && isalpha(str[0])) {
+            if (str[0] != '-' && isalpha((unsigned char)str[0])) {
                 SigMatch *bed_sm =
                     DetectByteExtractRetrieveSMVar(str, s,
                                                    SigMatchListSMBelongsTo(s, pm));
index a52176e2db7de78aedff2c7388162416e0ffc9e8..cde2ed75300aca7ba476dfa7811ea972f424f541 100644 (file)
@@ -1661,7 +1661,7 @@ int DetectParseContentString (char *contentstr, uint8_t **result, uint16_t *resu
 
     /* skip the first spaces */
     slen = strlen(temp);
-    while (pos < slen && isspace(temp[pos])) {
+    while (pos < slen && isspace((unsigned char)temp[pos])) {
         pos++;
     }
 
@@ -1728,7 +1728,7 @@ int DetectParseContentString (char *contentstr, uint8_t **result, uint16_t *resu
                 escape = 1;
             } else {
                 if (bin) {
-                    if (isdigit(str[i]) ||
+                    if (isdigit((unsigned char)str[i]) ||
                             str[i] == 'A' || str[i] == 'a' ||
                             str[i] == 'B' || str[i] == 'b' ||
                             str[i] == 'C' || str[i] == 'c' ||
index 3e10f1b2582785017c3863b14d784e88235341fc..adbad0563150cfe3169bb90defa9b26bc35f6c7b 100644 (file)
@@ -269,7 +269,7 @@ DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx, char *regexstr)
     uint16_t pos = 0;
     uint8_t negate = 0;
 
-    while (pos < slen && isspace(regexstr[pos])) {
+    while (pos < slen && isspace((unsigned char)regexstr[pos])) {
         pos++;
     }
 
index fb14f68bdfd5a93bb3cce374ac1b6eed13c9f815..603b3b018d07e9b121667ae74d88497431dd3957 100644 (file)
@@ -168,7 +168,7 @@ static int DetectPktvarSetup (DetectEngineCtx *de_ctx, Signature *s, char *rawst
                 }
             } else {
                 if (bin) {
-                    if (isdigit(str[i]) ||
+                    if (isdigit((unsigned char)str[i]) ||
                         str[i] == 'A' || str[i] == 'a' ||
                         str[i] == 'B' || str[i] == 'b' ||
                         str[i] == 'C' || str[i] == 'c' ||
index 90d9e81433800f3efcae8473d58f69c3bfd9d39f..942dd28b5e58b3290f71101c1c948eb1c88b4370 100644 (file)
@@ -153,7 +153,7 @@ DetectTosData *DetectTosParse(char *arg)
         negated = 1;
     }
 
-    while (isspace(*str_ptr))
+    while (isspace((unsigned char)*str_ptr))
         str_ptr++;
 
     if (*str_ptr == 'x' || *str_ptr == 'X') {
index a267c3c85a19fa8dd60e85830992c4be096358c6..b64ac9dbfb34a24d44492b28697680dda6ae75c2 100644 (file)
@@ -220,7 +220,7 @@ static int DetectWithinSetup (DetectEngineCtx *de_ctx, Signature *s, char *withi
                 goto error;
             }
 
-            if (str[0] != '-' && isalpha(str[0])) {
+            if (str[0] != '-' && isalpha((unsigned char)str[0])) {
                 SigMatch *bed_sm =
                     DetectByteExtractRetrieveSMVar(str, s,
                                                    SigMatchListSMBelongsTo(s, pm));
index 9d70d29e5b9d476840e0916c7f18defbcf1f5740..1833e7432eedd8c4be54d3c7cdcce4eabaa774ec 100644 (file)
@@ -303,7 +303,7 @@ int DetectLoadSigFile(DetectEngineCtx *de_ctx, char *sig_file, int *sigs_tot) {
             continue;
 
         /* Check for multiline rules. */
-        while (len > 0 && isspace(line[--len]));
+        while (len > 0 && isspace((unsigned char)line[--len]));
         if (line[len] == '\\') {
             multiline++;
             offset = len;
index 7cd7e7700e7f061e66cbfb8fa0573562a5656654..f0aa7186ebbbfba2de0498eb7818158d7f4996a8 100644 (file)
@@ -555,6 +555,7 @@ void *FlowManagerThread(void *td)
 
     TmThreadsSetFlag(th_v, THV_CLOSED);
     pthread_exit((void *) 0);
+    return NULL;
 }
 
 /** \brief spawn the flow manager thread */
index ac89f13a062b97b512e784d951a62acc8a43ebe7..3e714a42ddbdc7c29c82f02cbd05b2ce864100c4 100644 (file)
@@ -1057,7 +1057,7 @@ int main(int argc, char **argv)
 
             if (strcmp(pcap_dev, optarg) != 0) {
                 SCLogInfo("translated %s to pcap device %s", optarg, pcap_dev);
-            } else if (strlen(pcap_dev) > 0 && isdigit(pcap_dev[0])) {
+            } else if (strlen(pcap_dev) > 0 && isdigit((unsigned char)pcap_dev[0])) {
                 SCLogError(SC_ERR_PCAP_TRANSLATE, "failed to find a pcap device for IP %s", optarg);
                 exit(EXIT_FAILURE);
             }
index 883e9c3f1a3bcbff07d0eab41a26f7d6e93d420a..8b4fbb142aa4726e0000b48e4be31c8248f766e6 100644 (file)
@@ -158,6 +158,7 @@ void *TmThreadsSlot1NoIn(void *td)
 
             TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
             pthread_exit((void *) -1);
+            return NULL;
         }
         (void)SC_ATOMIC_SET(s->slot_data, slot_data);
     }
@@ -220,11 +221,13 @@ void *TmThreadsSlot1NoIn(void *td)
         if (r != TM_ECODE_OK) {
             TmThreadsSetFlag(tv, THV_CLOSED);
             pthread_exit((void *) -1);
+            return NULL;
         }
     }
 
     TmThreadsSetFlag(tv, THV_CLOSED);
     pthread_exit((void *) 0);
+    return NULL;
 }
 
 void *TmThreadsSlot1NoOut(void *td)
@@ -257,6 +260,7 @@ void *TmThreadsSlot1NoOut(void *td)
 
             TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
             pthread_exit((void *) -1);
+            return NULL;
         }
         (void)SC_ATOMIC_SET(s->slot_data, slot_data);
     }
@@ -301,11 +305,13 @@ void *TmThreadsSlot1NoOut(void *td)
         if (r != TM_ECODE_OK) {
             TmThreadsSetFlag(tv, THV_CLOSED);
             pthread_exit((void *) -1);
+            return NULL;
         }
     }
 
     TmThreadsSetFlag(tv, THV_CLOSED);
     pthread_exit((void *) 0);
+    return NULL;
 }
 
 void *TmThreadsSlot1NoInOut(void *td)
@@ -339,6 +345,7 @@ void *TmThreadsSlot1NoInOut(void *td)
 
             TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
             pthread_exit((void *) -1);
+            return NULL;
         }
         (void)SC_ATOMIC_SET(s->slot_data, slot_data);
     }
@@ -377,11 +384,13 @@ void *TmThreadsSlot1NoInOut(void *td)
         if (r != TM_ECODE_OK) {
             TmThreadsSetFlag(tv, THV_CLOSED);
             pthread_exit((void *) -1);
+            return NULL;
         }
     }
 
     TmThreadsSetFlag(tv, THV_CLOSED);
     pthread_exit((void *) 0);
+    return NULL;
 }
 
 void *TmThreadsSlot1(void *td)
@@ -416,6 +425,7 @@ void *TmThreadsSlot1(void *td)
 
             TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
             pthread_exit((void *) -1);
+            return NULL;
         }
         (void)SC_ATOMIC_SET(s->slot_data, slot_data);
     }
@@ -492,12 +502,14 @@ void *TmThreadsSlot1(void *td)
         if (r != TM_ECODE_OK) {
             TmThreadsSetFlag(tv, THV_CLOSED);
             pthread_exit((void *) -1);
+            return NULL;
         }
     }
 
     SCLogDebug("%s ending", tv->name);
     TmThreadsSetFlag(tv, THV_CLOSED);
     pthread_exit((void *) 0);
+    return NULL;
 }
 
 /**
@@ -623,6 +635,7 @@ void *TmThreadsSlotPktAcqLoop(void *td) {
 
         TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
         pthread_exit((void *) -1);
+        return NULL;
     }
 
     for (slot = s; slot != NULL; slot = slot->slot_next) {
@@ -634,6 +647,7 @@ void *TmThreadsSlotPktAcqLoop(void *td) {
 
                 TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
                 pthread_exit((void *) -1);
+                return NULL;
             }
             (void)SC_ATOMIC_SET(slot->slot_data, slot_data);
         }
@@ -670,6 +684,7 @@ void *TmThreadsSlotPktAcqLoop(void *td) {
             if (r != TM_ECODE_OK) {
                 TmThreadsSetFlag(tv, THV_CLOSED);
                 pthread_exit((void *) -1);
+                return NULL;
             }
         }
     }
@@ -677,6 +692,7 @@ void *TmThreadsSlotPktAcqLoop(void *td) {
     SCLogDebug("%s ending", tv->name);
     TmThreadsSetFlag(tv, THV_CLOSED);
     pthread_exit((void *) 0);
+    return NULL;
 }
 
 
@@ -712,6 +728,7 @@ void *TmThreadsSlotVar(void *td)
 
         TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
         pthread_exit((void *) -1);
+        return NULL;
     }
 
     for (; s != NULL; s = s->slot_next) {
@@ -723,6 +740,7 @@ void *TmThreadsSlotVar(void *td)
 
                 TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
                 pthread_exit((void *) -1);
+                return NULL;
             }
             (void)SC_ATOMIC_SET(s->slot_data, slot_data);
         }
@@ -807,6 +825,7 @@ void *TmThreadsSlotVar(void *td)
             if (r != TM_ECODE_OK) {
                 TmThreadsSetFlag(tv, THV_CLOSED);
                 pthread_exit((void *) -1);
+                return NULL;
             }
         }
     }
@@ -814,6 +833,7 @@ void *TmThreadsSlotVar(void *td)
     SCLogDebug("%s ending", tv->name);
     TmThreadsSetFlag(tv, THV_CLOSED);
     pthread_exit((void *) 0);
+    return NULL;
 }
 
 /**
index d270bafcbffecba9fca72b07c4418a68947c284b..72cfadaaa00db16008be3cd2a09d53c6e8328f8b 100644 (file)
@@ -211,7 +211,7 @@ static char *SCClassConfStringToLowercase(const char *str)
 
     temp_str = new_str;
     while (*temp_str != '\0') {
-        *temp_str = tolower(*temp_str);
+        *temp_str = tolower((unsigned char)*temp_str);
         temp_str++;
     }
 
@@ -328,7 +328,7 @@ static int SCClassConfIsLineBlankOrComment(char *line)
             return 1;
 
         /* this line is neither a comment line, nor a blank line */
-        if (!isspace(*line))
+        if (!isspace((unsigned char)*line))
             return 0;
 
         line++;
@@ -446,7 +446,7 @@ uint32_t SCClassConfClasstypeHashFunc(HashTable *ht, void *data, uint16_t datale
     int len = strlen(ct->classtype);
 
     for (i = 0; i < len; i++)
-        hash += tolower((ct->classtype)[i]);
+        hash += tolower((unsigned char)(ct->classtype)[i]);
 
     hash = hash % ht->array_size;
 
index fb343140487dc966edb0896146a8ddfb81db0922..e2d1698de2a93e1c33fd1acdfa71c33b9aa363b0 100644 (file)
@@ -58,7 +58,6 @@ SCEnumCharMap sc_hinfo_os_policy_map[ ] = {
 
 /** Radix tree that holds the host OS information */
 static SCRadixTree *sc_hinfo_tree = NULL;
-static SCRadixTree *sc_hinfo_tree_backup = NULL;
 
 /**
  * \brief Validates an IPV4 address and returns the network endian arranged
@@ -431,6 +430,7 @@ void SCHInfoLoadFromConfig(void)
 /*------------------------------------Unit_Tests------------------------------*/
 
 #ifdef UNITTESTS
+static SCRadixTree *sc_hinfo_tree_backup = NULL;
 
 static void SCHInfoCreateContextBackup(void)
 {
index 8be7d96bfb9dede8ae92c1a7358f8ff8a28ca5e2..09621320f76a7b96afc09c475601b1101ea24ee0 100644 (file)
@@ -42,7 +42,7 @@ int PathIsAbsolute(const char *path) {
 
 #if (defined OS_WIN32 || defined __CYGWIN__)
     if (strlen(path) > 2) {
-        if (isalpha(path[0]) && path[1] == ':') {
+        if (isalpha((unsigned char)path[0]) && path[1] == ':') {
             return 1;
         }
     }
index af87e9ab6947a31fa50b83c8206f9d3783cb93d6..0d221b347286ad80de52b8b3940251714e8ba414 100644 (file)
@@ -161,7 +161,7 @@ int SCGetUserID(char *user_name, char *group_name, uint32_t *uid, uint32_t *gid)
     struct passwd *pw;
 
     /* Get the user ID */
-    if (isdigit(user_name[0]) != 0) {
+    if (isdigit((unsigned char)user_name[0]) != 0) {
         userid = atoi(user_name);
         pw = getpwuid(userid);
        if (pw == NULL) {
@@ -183,7 +183,7 @@ int SCGetUserID(char *user_name, char *group_name, uint32_t *uid, uint32_t *gid)
     if (group_name != NULL) {
         struct group *gp;
 
-        if (isdigit(group_name[0]) != 0) {
+        if (isdigit((unsigned char)group_name[0]) != 0) {
             groupid = atoi(group_name);
         } else {
             gp = getgrnam(group_name);
@@ -223,7 +223,7 @@ int SCGetGroupID(char *group_name, uint32_t *gid)
     struct group *gp;
 
     /* Get the group ID */
-    if (isdigit(group_name[0]) != 0) {
+    if (isdigit((unsigned char)group_name[0]) != 0) {
         grpid = atoi(group_name);
     } else {
         gp = getgrnam(group_name);
index 8212c3b522765200afd8d9d17a989a4d7a286271..1eb8047e055cc4ef0169e3e56db5b658818cd967 100644 (file)
@@ -206,7 +206,7 @@ static char *SCRConfStringToLowercase(const char *str)
 
     temp_str = new_str;
     while (*temp_str != '\0') {
-        *temp_str = tolower(*temp_str);
+        *temp_str = tolower((unsigned char)*temp_str);
         temp_str++;
     }
 
@@ -305,7 +305,7 @@ static int SCRConfIsLineBlankOrComment(char *line)
             return 1;
 
         /* this line is neither a comment line, nor a blank line */
-        if (!isspace(*line))
+        if (!isspace((unsigned char)*line))
             return 0;
 
         line++;
@@ -418,7 +418,7 @@ uint32_t SCRConfReferenceHashFunc(HashTable *ht, void *data, uint16_t datalen)
     int len = strlen(ref->system);
 
     for (i = 0; i < len; i++)
-        hash += tolower(ref->system[i]);
+        hash += tolower((unsigned char)ref->system[i]);
 
     hash = hash % ht->array_size;
 
index d7183ba0f81b4cf218e3873dfce8a0ed7f5180e7..3b659c37ccdd7468b58f3c3e3e1c92ed22128495 100644 (file)
@@ -863,7 +863,7 @@ int SCThresholdConfIsLineBlankOrComment(char *line)
             return 1;
 
         /* this line is neither a comment line, nor a blank line */
-        if (!isspace(*line))
+        if (!isspace((unsigned char)*line))
             return 0;
 
         line++;
@@ -892,7 +892,7 @@ int SCThresholdConfLineIsMultiline(char *line)
         if (*line == '\\')
             flag = line - rline;
         else
-            if (!isspace(*line))
+            if (!isspace((unsigned char)*line))
                 flag = 0;
 
         line++;