mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
binary registry: Rewrite sanity check to actualy catch something.
The previous commit was bogus, as was the check before. We just point m to the file data, so neither it nor its members will be NULL. Better check if we have enough data.
This commit is contained in:
parent
e060eec302
commit
b87960ae5d
1 changed files with 4 additions and 3 deletions
|
@ -786,12 +786,13 @@ gst_registry_binary_check_magic (gchar ** in, gsize size)
|
|||
|
||||
align (*in);
|
||||
GST_DEBUG ("Reading/casting for GstBinaryRegistryMagic at address %p", *in);
|
||||
unpack_element (*in, m, GstBinaryRegistryMagic);
|
||||
|
||||
if (m == NULL || &m->magic == NULL || &m->version == NULL) {
|
||||
GST_WARNING ("Binary registry magic structure is broken");
|
||||
if (size < sizeof (GstBinaryRegistryMagic)) {
|
||||
GST_WARNING ("Not enough data for binary registry magic structure");
|
||||
return -1;
|
||||
}
|
||||
unpack_element (*in, m, GstBinaryRegistryMagic);
|
||||
|
||||
if (strncmp (m->magic, GST_MAGIC_BINARY_REGISTRY_STR,
|
||||
GST_MAGIC_BINARY_REGISTRY_LEN) != 0) {
|
||||
GST_WARNING
|
||||
|
|
Loading…
Reference in a new issue