mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Merge branch 'topic/corelight/eval-condition-crash' of https://github.com/corelight/bro
* 'topic/corelight/eval-condition-crash' of https://github.com/corelight/bro: Fix segmentation fault on eval condition with no return value.
This commit is contained in:
commit
e7d3dd0818
4 changed files with 34 additions and 2 deletions
|
@ -175,9 +175,15 @@ bool RuleConditionEval::DoMatch(Rule* rule, RuleEndpointState* state,
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Val* val = id->ID_Val()->AsFunc()->Call(&args);
|
Val* val = id->ID_Val()->AsFunc()->Call(&args);
|
||||||
|
|
||||||
|
if ( val )
|
||||||
|
{
|
||||||
result = val->AsBool();
|
result = val->AsBool();
|
||||||
Unref(val);
|
Unref(val);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
catch ( InterpreterException& e )
|
catch ( InterpreterException& e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
1329843162.083353 warning: non-void function returns without a value: mark_conn
|
||||||
|
1329843164.920456 warning: non-void function returns without a value: mark_conn
|
||||||
|
1329843200.079930 warning: non-void function returns without a value: mark_conn
|
|
@ -0,0 +1,3 @@
|
||||||
|
Called
|
||||||
|
Called
|
||||||
|
Called
|
20
testing/btest/signatures/eval-condition-no-return-value.bro
Normal file
20
testing/btest/signatures/eval-condition-no-return-value.bro
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# @TEST-EXEC: bro -r $TRACES/ftp/ipv4.trace %INPUT
|
||||||
|
# @TEST-EXEC: btest-diff .stdout
|
||||||
|
# @TEST-EXEC: btest-diff .stderr
|
||||||
|
|
||||||
|
@load-sigs blah.sig
|
||||||
|
|
||||||
|
@TEST-START-FILE blah.sig
|
||||||
|
signature blah
|
||||||
|
{
|
||||||
|
ip-proto == tcp
|
||||||
|
src-port == 21
|
||||||
|
payload /.*/
|
||||||
|
eval mark_conn
|
||||||
|
}
|
||||||
|
@TEST-END-FILE
|
||||||
|
|
||||||
|
function mark_conn(state: signature_state, data: string): bool
|
||||||
|
{
|
||||||
|
print "Called";
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue