ScriptValidation: Make break/next a warning until Zeek 6.1

The ja3 package uses next instead of return and triggers the new
errors with Zeek 5.2. That seems somewhat bad.

In case we want to do a 5.2.1 that makes this a warning, this
would be change to do so.
This commit is contained in:
Arne Welzel 2023-03-02 18:45:14 +01:00
parent 802d24cad7
commit 56c76e5949
11 changed files with 17 additions and 15 deletions

View file

@ -22,15 +22,17 @@ public:
if ( stmt->Tag() == STMT_BREAK && ! BreakStmtIsValid() )
{
zeek::reporter->PushLocation(stmt->GetLocationInfo());
zeek::reporter->Error("break statement used outside of for, while or "
"switch statement and not within a hook");
zeek::reporter->Warning("break statement used outside of for, while or "
"switch statement and not within a hook. "
"With v6.1 this will become an error.");
zeek::reporter->PopLocation();
}
if ( stmt->Tag() == STMT_NEXT && ! NextStmtIsValid() )
{
zeek::reporter->PushLocation(stmt->GetLocationInfo());
zeek::reporter->Error("next statement used outside of for or while statement");
zeek::reporter->Warning("next statement used outside of for or while statement. "
"With v6.1 this will become an error.");
zeek::reporter->PopLocation();
}