Fix possible null pointer dereference in identify_data BIF.

There was no check/handling for if magic_buffer() returns null.
Also centralized libmagic calls for consistent error handling/output.
This commit is contained in:
Jon Siwek 2013-02-27 16:04:36 -06:00
parent dd9f361bc7
commit 2481f9f837
5 changed files with 47 additions and 46 deletions

View file

@ -15,6 +15,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <magic.h>
#include "config.h"
#if __STDC__
@ -364,4 +365,7 @@ struct CompareString
}
};
void bro_init_magic(magic_t* cookie_ptr, int flags);
const char* bro_magic_buffer(magic_t cookie, const void* buffer, size_t length);
#endif