detect-engine/tags: avoid confusion over data type

pull/4832/head
Victor Julien 5 years ago
parent 5b9d17b485
commit 7553937a22

@ -184,7 +184,7 @@ int TagHashAddTag(DetectTagDataEntry *tde, Packet *p)
SCEnter(); SCEnter();
uint8_t updated = 0; uint8_t updated = 0;
uint16_t num_tags = 0; uint16_t ntags = 0;
Host *host = NULL; Host *host = NULL;
/* Lookup host in the hash. If it doesn't exist yet it's /* Lookup host in the hash. If it doesn't exist yet it's
@ -217,7 +217,7 @@ int TagHashAddTag(DetectTagDataEntry *tde, Packet *p)
DetectTagDataEntry *iter = NULL; DetectTagDataEntry *iter = NULL;
for (iter = tag; iter != NULL; iter = iter->next) { for (iter = tag; iter != NULL; iter = iter->next) {
num_tags++; ntags++;
if (iter->sid == tde->sid && iter->gid == tde->gid) { if (iter->sid == tde->sid && iter->gid == tde->gid) {
iter->cnt_match++; iter->cnt_match++;
/* If so, update data, unless the maximum MATCH limit is /* If so, update data, unless the maximum MATCH limit is
@ -234,7 +234,7 @@ int TagHashAddTag(DetectTagDataEntry *tde, Packet *p)
} }
/* If there was no entry of this rule, append the new tde */ /* If there was no entry of this rule, append the new tde */
if (updated == 0 && num_tags < DETECT_TAG_MAX_TAGS) { if (updated == 0 && ntags < DETECT_TAG_MAX_TAGS) {
/* get a new tde as the one we have is on the stack */ /* get a new tde as the one we have is on the stack */
DetectTagDataEntry *new_tde = DetectTagDataCopy(tde); DetectTagDataEntry *new_tde = DetectTagDataCopy(tde);
if (new_tde != NULL) { if (new_tde != NULL) {
@ -243,8 +243,8 @@ int TagHashAddTag(DetectTagDataEntry *tde, Packet *p)
new_tde->next = tag; new_tde->next = tag;
HostSetStorageById(host, host_tag_id, new_tde); HostSetStorageById(host, host_tag_id, new_tde);
} }
} else if (num_tags == DETECT_TAG_MAX_TAGS) { } else if (ntags == DETECT_TAG_MAX_TAGS) {
SCLogDebug("Max tags for sessions reached (%"PRIu16")", num_tags); SCLogDebug("Max tags for sessions reached (%"PRIu16")", ntags);
} }
} }

Loading…
Cancel
Save