mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix DNS script deleting a table element while iterating
Doesn't typically cause any problems since the loop breaks after deleting, except there's now an assert in debug builds catching potential problems like this.
This commit is contained in:
parent
f613cb0c68
commit
fef4fda2f7
1 changed files with 8 additions and 1 deletions
|
@ -285,12 +285,19 @@ hook set_session(c: connection, msg: dns_msg, is_query: bool) &priority=5
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
# Just pick an arbitrary, unpaired query.
|
# Just pick an arbitrary, unpaired query.
|
||||||
|
local tid: count;
|
||||||
|
local found_one = F;
|
||||||
|
|
||||||
for ( trans_id, q in c$dns_state$pending_queries )
|
for ( trans_id, q in c$dns_state$pending_queries )
|
||||||
if ( Queue::len(q) > 0 )
|
if ( Queue::len(q) > 0 )
|
||||||
{
|
{
|
||||||
c$dns_state$pending_query = pop_msg(c$dns_state$pending_queries, trans_id);
|
tid = trans_id;
|
||||||
|
found_one = T;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( found_one )
|
||||||
|
c$dns_state$pending_query = pop_msg(c$dns_state$pending_queries, tid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue