mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
Fix a segfault when iterating over a set
When iterating over a set with a "for" loop, bro would segfault when the number of index variables was less than required. Example: for ( [c1,c2] in s1 ) ... where s1 is defined as set[addr,port,count].
This commit is contained in:
parent
22cf75dae5
commit
63a550fa9e
1 changed files with 3 additions and 0 deletions
|
@ -943,7 +943,10 @@ ForStmt::ForStmt(id_list* arg_loop_vars, Expr* loop_expr)
|
|||
{
|
||||
const type_list* indices = e->Type()->AsTableType()->IndexTypes();
|
||||
if ( indices->length() != loop_vars->length() )
|
||||
{
|
||||
e->Error("wrong index size");
|
||||
return;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < indices->length(); i++ )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue