* 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;
}
/* 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 "
}
/* 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 "
}
/* 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 "
}
/* skip the first spaces */
- while (pos < slen && isspace(contentstr[pos]))
+ while (pos < slen && isspace((unsigned char)contentstr[pos]))
pos++;
if (contentstr[pos] == '!') {
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' ||
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));
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));
/* 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;
}
/* 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;
}
SCLogInfo("===== Live rule swap DONE =====");
pthread_exit(NULL);
+ return NULL;
}
void DetectEngineSpawnLiveRuleSwapMgmtThread(void)
}
} 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' ||
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 {
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++;
}
/* 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",
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 "
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));
/* skip the first spaces */
slen = strlen(temp);
- while (pos < slen && isspace(temp[pos])) {
+ while (pos < slen && isspace((unsigned char)temp[pos])) {
pos++;
}
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' ||
uint16_t pos = 0;
uint8_t negate = 0;
- while (pos < slen && isspace(regexstr[pos])) {
+ while (pos < slen && isspace((unsigned char)regexstr[pos])) {
pos++;
}
}
} 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' ||
negated = 1;
}
- while (isspace(*str_ptr))
+ while (isspace((unsigned char)*str_ptr))
str_ptr++;
if (*str_ptr == 'x' || *str_ptr == 'X') {
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));
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;
TmThreadsSetFlag(th_v, THV_CLOSED);
pthread_exit((void *) 0);
+ return NULL;
}
/** \brief spawn the flow manager thread */
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);
}
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
+ return NULL;
}
(void)SC_ATOMIC_SET(s->slot_data, slot_data);
}
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)
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
+ return NULL;
}
(void)SC_ATOMIC_SET(s->slot_data, slot_data);
}
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)
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
+ return NULL;
}
(void)SC_ATOMIC_SET(s->slot_data, slot_data);
}
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)
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
+ return NULL;
}
(void)SC_ATOMIC_SET(s->slot_data, slot_data);
}
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;
}
/**
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
+ return NULL;
}
for (slot = s; slot != NULL; slot = slot->slot_next) {
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
+ return NULL;
}
(void)SC_ATOMIC_SET(slot->slot_data, slot_data);
}
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;
}
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
+ return NULL;
}
for (; s != NULL; s = s->slot_next) {
TmThreadsSetFlag(tv, THV_CLOSED | THV_RUNNING_DONE);
pthread_exit((void *) -1);
+ return NULL;
}
(void)SC_ATOMIC_SET(s->slot_data, slot_data);
}
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;
}
/**
temp_str = new_str;
while (*temp_str != '\0') {
- *temp_str = tolower(*temp_str);
+ *temp_str = tolower((unsigned char)*temp_str);
temp_str++;
}
return 1;
/* this line is neither a comment line, nor a blank line */
- if (!isspace(*line))
+ if (!isspace((unsigned char)*line))
return 0;
line++;
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;
/** 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
/*------------------------------------Unit_Tests------------------------------*/
#ifdef UNITTESTS
+static SCRadixTree *sc_hinfo_tree_backup = NULL;
static void SCHInfoCreateContextBackup(void)
{
#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;
}
}
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) {
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);
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);
temp_str = new_str;
while (*temp_str != '\0') {
- *temp_str = tolower(*temp_str);
+ *temp_str = tolower((unsigned char)*temp_str);
temp_str++;
}
return 1;
/* this line is neither a comment line, nor a blank line */
- if (!isspace(*line))
+ if (!isspace((unsigned char)*line))
return 0;
line++;
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;
return 1;
/* this line is neither a comment line, nor a blank line */
- if (!isspace(*line))
+ if (!isspace((unsigned char)*line))
return 0;
line++;
if (*line == '\\')
flag = line - rline;
else
- if (!isspace(*line))
+ if (!isspace((unsigned char)*line))
flag = 0;
line++;