summaryrefslogtreecommitdiff
path: root/gst/gstregistrybinary.c
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2009-02-06 10:51:28 +0200
committerStefan Kost <ensonic@users.sf.net>2009-02-06 10:51:28 +0200
commitb87960ae5d7ae1e45aed3712c0f507a4d7af73fd (patch)
tree56e692f45033675e4df6789d6d5217b3fd78f5e4 /gst/gstregistrybinary.c
parente060eec302e82ba7944518bece3ecda71c3b34dd (diff)
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.
Diffstat (limited to 'gst/gstregistrybinary.c')
-rw-r--r--gst/gstregistrybinary.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gst/gstregistrybinary.c b/gst/gstregistrybinary.c
index 54a27d45b..cd373e9ab 100644
--- a/gst/gstregistrybinary.c
+++ b/gst/gstregistrybinary.c
@@ -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