mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48: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
|
@ -23,6 +23,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include <openssl/md5.h>
|
||||
#include <magic.h>
|
||||
|
||||
extern "C" void OPENSSL_add_all_algorithms_conf(void);
|
||||
|
||||
|
@ -64,6 +65,9 @@ extern "C" void OPENSSL_add_all_algorithms_conf(void);
|
|||
|
||||
Brofiler brofiler;
|
||||
|
||||
magic_t magic_desc_cookie = 0;
|
||||
magic_t magic_mime_cookie = 0;
|
||||
|
||||
#ifndef HAVE_STRSEP
|
||||
extern "C" {
|
||||
char* strsep(char**, const char*);
|
||||
|
@ -730,6 +734,9 @@ int main(int argc, char** argv)
|
|||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
#endif
|
||||
|
||||
bro_init_magic(&magic_desc_cookie, MAGIC_NONE);
|
||||
bro_init_magic(&magic_mime_cookie, MAGIC_MIME);
|
||||
|
||||
// FIXME: On systems that don't provide /dev/urandom, OpenSSL doesn't
|
||||
// seed the PRNG. We should do this here (but at least Linux, FreeBSD
|
||||
// and Solaris provide /dev/urandom).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue