Skip to content

Commit

Permalink
detect-engine/tags: avoid confusion over data type
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjulien committed Apr 16, 2020
1 parent 5b9d17b commit 7553937
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/detect-engine-tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int TagHashAddTag(DetectTagDataEntry *tde, Packet *p)
SCEnter();

uint8_t updated = 0;
uint16_t num_tags = 0;
uint16_t ntags = 0;
Host *host = NULL;

/* Lookup host in the hash. If it doesn't exist yet it's
Expand Down Expand Up @@ -217,7 +217,7 @@ int TagHashAddTag(DetectTagDataEntry *tde, Packet *p)
DetectTagDataEntry *iter = NULL;

for (iter = tag; iter != NULL; iter = iter->next) {
num_tags++;
ntags++;
if (iter->sid == tde->sid && iter->gid == tde->gid) {
iter->cnt_match++;
/* If so, update data, unless the maximum MATCH limit is
Expand All @@ -234,7 +234,7 @@ int TagHashAddTag(DetectTagDataEntry *tde, Packet *p)
}

/* 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 */
DetectTagDataEntry *new_tde = DetectTagDataCopy(tde);
if (new_tde != NULL) {
Expand All @@ -243,8 +243,8 @@ int TagHashAddTag(DetectTagDataEntry *tde, Packet *p)
new_tde->next = tag;
HostSetStorageById(host, host_tag_id, new_tde);
}
} else if (num_tags == DETECT_TAG_MAX_TAGS) {
SCLogDebug("Max tags for sessions reached (%"PRIu16")", num_tags);
} else if (ntags == DETECT_TAG_MAX_TAGS) {
SCLogDebug("Max tags for sessions reached (%"PRIu16")", ntags);
}
}

Expand Down

0 comments on commit 7553937

Please sign in to comment.