Skip to content

Commit 77f866f

Browse files
authored
feat: improved detection whether a string requires all matches (#2167)
String sets like ($s*) always removed the STRING_FLAGS_SINGLE_MATCH flag, but only some operators (e.g. 1 of ($s*) at 0) actually mandated this. In practice, the most common use case of string sets is n of ($s*), which does not necessitate removing STRING_FLAGS_SINGLE_MATCH. Add logic to the operators to only remove this flag where it is necessary.
1 parent fc4b114 commit 77f866f

File tree

7 files changed

+535
-418
lines changed

7 files changed

+535
-418
lines changed

libyara/compiler.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,3 +1078,14 @@ YR_API char* yr_compiler_get_error_message(
10781078

10791079
return buffer;
10801080
}
1081+
1082+
YR_API int yr_string_set_destroy(YR_STRING_SET string_set)
1083+
{
1084+
YR_STRING_SET_ELEMENT* head = string_set.head;
1085+
while (head != NULL) {
1086+
YR_STRING_SET_ELEMENT* next_head = head->next;
1087+
yr_free(head);
1088+
head = next_head;
1089+
}
1090+
return ERROR_SUCCESS;
1091+
}

0 commit comments

Comments
 (0)