mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
FileAnalysis: load custom mime magic database just once.
This works around a bug in libmagic since version 5.12 (current at time of writing is 5.14) -- second call to magic_load() w/ non-default database segfaults.
This commit is contained in:
parent
d22f30e9a1
commit
0141f51801
7 changed files with 15 additions and 32 deletions
|
@ -49,8 +49,6 @@ int File::bof_buffer_size_idx = -1;
|
|||
int File::bof_buffer_idx = -1;
|
||||
int File::mime_type_idx = -1;
|
||||
|
||||
magic_t File::magic_mime = 0;
|
||||
|
||||
string File::salt;
|
||||
|
||||
void File::StaticInit()
|
||||
|
@ -72,8 +70,6 @@ void File::StaticInit()
|
|||
bof_buffer_idx = Idx("bof_buffer");
|
||||
mime_type_idx = Idx("mime_type");
|
||||
|
||||
bro_init_magic(&magic_mime, MAGIC_MIME);
|
||||
|
||||
salt = BifConst::FileAnalysis::salt->CheckString();
|
||||
}
|
||||
|
||||
|
@ -250,7 +246,7 @@ bool File::BufferBOF(const u_char* data, uint64 len)
|
|||
|
||||
bool File::DetectMIME(const u_char* data, uint64 len)
|
||||
{
|
||||
const char* mime = bro_magic_buffer(magic_mime, data, len);
|
||||
const char* mime = bro_magic_buffer(magic_mime_cookie, data, len);
|
||||
|
||||
if ( mime )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue