app: fix file_check_magic_list() to handle "and" matches again
where the magic is only supposed to match if all magics in the "and" list match.
This commit is contained in:
@ -658,6 +658,8 @@ file_check_magic_list (GSList *magics_list,
|
||||
else
|
||||
found = (single_match_val != FILE_MATCH_NONE);
|
||||
|
||||
if (found)
|
||||
{
|
||||
if (match_val == FILE_MATCH_NONE)
|
||||
{
|
||||
/* if we have no match yet, this is it in any case */
|
||||
@ -692,6 +694,17 @@ file_check_magic_list (GSList *magics_list,
|
||||
match_val = single_match_val + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
match_val = FILE_MATCH_NONE;
|
||||
}
|
||||
|
||||
and = (strchr (offset, '&') != NULL);
|
||||
|
||||
if (! and)
|
||||
{
|
||||
/* when done with this 'and' list, update best_match_val */
|
||||
|
||||
if (best_match_val == FILE_MATCH_NONE)
|
||||
{
|
||||
@ -709,11 +722,9 @@ file_check_magic_list (GSList *magics_list,
|
||||
best_match_val = MAX (best_match_val, match_val);
|
||||
}
|
||||
|
||||
and = (strchr (offset, '&') != NULL);
|
||||
|
||||
if (! and)
|
||||
match_val = FILE_MATCH_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
return best_match_val;
|
||||
}
|
||||
|
Reference in New Issue
Block a user