File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -804,11 +804,13 @@ int yara_callback(
804804 return CALLBACK_CONTINUE ;
805805
806806 case CALLBACK_MSG_RULE_NOT_MATCHING :
807- // If the rule doesn't match and the user has not specified that they want
808- // to see non-matches then there's nothing more to do and we return
809- // CALLBACK_CONTINUE, keep executing the function if otherwise.
807+ // In cases where the rule doesn't match and the user didn't provided a
808+ // callback function or is not interested in getting notified about
809+ // non-matches, there's nothing more do to here, keep executing the function
810+ // if otherwise.
810811
811- if ((which & CALLBACK_NON_MATCHES ) != CALLBACK_NON_MATCHES )
812+ if (callback == NULL ||
813+ (which & CALLBACK_NON_MATCHES ) != CALLBACK_NON_MATCHES )
812814 return CALLBACK_CONTINUE ;
813815 }
814816
@@ -1616,6 +1618,7 @@ static PyObject* Rules_match(
16161618 callback_data .matches = PyList_New (0 );
16171619
16181620 Py_BEGIN_ALLOW_THREADS
1621+
16191622 error = yr_rules_scan_file (
16201623 object -> rules ,
16211624 filepath ,
@@ -1624,7 +1627,6 @@ static PyObject* Rules_match(
16241627 & callback_data ,
16251628 timeout );
16261629
1627-
16281630 Py_END_ALLOW_THREADS
16291631 }
16301632 else if (data .buf != NULL )
You can’t perform that action at this time.
0 commit comments