mirror of
https://github.com/mandiant/capa.git
synced 2026-06-12 19:11:32 -07:00
fix: parenthesize s_type checks in capa2yara so kid.name guard applies to And/Or/Not uniformly
Without parentheses, Python's operator precedence caused `kid.name != "Some"` to only guard the `Not` branch; `And` and `Or` kids named `"Some"` would bypass the Some-handling block and enter recursive convert_rule unguarded.
This commit is contained in:
committed by
Willi Ballenthin
parent
fc7f0533d7
commit
ae4c2ec82d
@@ -414,7 +414,7 @@ def convert_rule(rule, rulename, cround, depth):
|
||||
# this is "x or more". could be coded for strings TODO
|
||||
return "BREAK", "Some aka x or more (TODO)", rule_comment, incomplete
|
||||
|
||||
if s_type == "And" or s_type == "Or" or s_type == "Not" and kid.name != "Some":
|
||||
if (s_type == "And" or s_type == "Or" or s_type == "Not") and kid.name != "Some":
|
||||
logger.info("doing bool with recursion: %r", kid)
|
||||
logger.info("kid coming: %r", kid.name)
|
||||
# logger.info("grandchildren: " + repr(kid.children))
|
||||
|
||||
Reference in New Issue
Block a user