Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining variables with the same name as private rules leads to undesired behaviour #920

Closed
CapacitorSet opened this issue Jul 25, 2018 · 1 comment

Comments

@CapacitorSet
Copy link

Test case:

private rule foo {
    condition: true
}

rule bar {
    condition: foo
}

If you test it with yara testcase.yara /dev/null, it prints a match as expected. However, defining foo as a falsy value prints no matches:

$ yara testcase.yara /dev/null
bar /dev/null
$ yara -d foo="" testcase.yara /dev/null
$ yara -d foo=0 testcase.yara /dev/null

I understand that this is a logically ambiguous case, but I think that the current behaviour is unexpected. I expected the private rule to have precedence over the variable, or an error to be thrown.

Thanks!

plusvic added a commit that referenced this issue Jul 25, 2018
@plusvic
Copy link
Member

plusvic commented Jul 25, 2018

With the latest fix it returns an error.

@plusvic plusvic closed this as completed Jul 25, 2018
tarterp pushed a commit to mandiant/yara that referenced this issue Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants