mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Weird: fix potential small issue when ignoring duplicates
In all versions so far, the identifier string that was used for comparisons might have been different from the identifier string that was added (when certain notices are used).
This commit is contained in:
parent
697b2748f5
commit
85220e46aa
2 changed files with 17 additions and 14 deletions
|
@ -349,32 +349,33 @@ function weird(w: Weird::Info)
|
|||
|
||||
if ( action in limiting_actions )
|
||||
{
|
||||
local notice_identifier = identifier;
|
||||
if ( action in notice_actions )
|
||||
{
|
||||
# Handle notices
|
||||
if ( w?$id && action == ACTION_NOTICE_PER_ORIG )
|
||||
identifier = fmt("%s", w$id$orig_h);
|
||||
notice_identifier = fmt("%s", w$id$orig_h);
|
||||
else if ( action == ACTION_NOTICE_ONCE )
|
||||
identifier = "";
|
||||
notice_identifier = "";
|
||||
|
||||
# If this weird was already noticed then we're done.
|
||||
if ( [w$name, identifier] in did_notice )
|
||||
if ( [w$name, notice_identifier] in did_notice )
|
||||
return;
|
||||
add did_notice[w$name, identifier];
|
||||
add did_notice[w$name, notice_identifier];
|
||||
}
|
||||
else
|
||||
{
|
||||
# Handle logging.
|
||||
if ( w?$id && action == ACTION_LOG_PER_ORIG )
|
||||
identifier = fmt("%s", w$id$orig_h);
|
||||
notice_identifier = fmt("%s", w$id$orig_h);
|
||||
else if ( action == ACTION_LOG_ONCE )
|
||||
identifier = "";
|
||||
notice_identifier = "";
|
||||
|
||||
# If this weird was already logged then we're done.
|
||||
if ( [w$name, identifier] in did_log )
|
||||
if ( [w$name, notice_identifier] in did_log )
|
||||
return;
|
||||
|
||||
add did_log[w$name, identifier];
|
||||
add did_log[w$name, notice_identifier];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue