mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
FileAnalysis: workarounds for older libmagics.
Some of the unit tests revealed different versions of libmagic could give different mime types for the same input file and magic database. One way that could happen is because of the use of hardcoded/builtin token (word) comparisons for ascii files -- MAGIC_NO_CHECK_TOKENS flag will prevent that from being used (and it's obsoleted in newer libmagics). The other problem looked like a bug fixed as of 5.05 where a match in the magic database that doesn't have a verbose description but does have a mime type won't actually return that mime type due to the the missing description. The one case where that kept popping up was in 5.04 not beign able to identify application/x-dosexec, so I added a description to the top-level match for that to workaround the issue.
This commit is contained in:
parent
037d582b0e
commit
cd2a6aa33a
3 changed files with 3 additions and 3 deletions
|
@ -1568,7 +1568,7 @@ void bro_init_magic(magic_t* cookie_ptr, int flags)
|
|||
if ( ! cookie_ptr || *cookie_ptr )
|
||||
return;
|
||||
|
||||
*cookie_ptr = magic_open(flags);
|
||||
*cookie_ptr = magic_open(flags|MAGIC_NO_CHECK_TOKENS);
|
||||
|
||||
// Use our custom database for mime types, but the default database
|
||||
// from libmagic for the verbose file type.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue