glib r6855 - in branches/glib-2-16/gio: . xdgmime



Author: matthiasc
Date: Wed Apr 16 17:56:38 2008
New Revision: 6855
URL: http://svn.gnome.org/viewvc/glib?rev=6855&view=rev

Log:
2008-04-16  Matthias Clasen  <mclasen redhat com>

        Avoid possible memory corruption in xdgmime, fd.o bug 12512,
        reported by Joe Shaw and Federico Mena Quintero.

        * xdgmime/xdgmime.c(_xdg_mime_media_type_equal): Implement.
        (xdg_mime_media_type_equal): Turn into a wrapper around the
        _-prefixed version.

        * xdgmime/xdgmimecache.c: Use the _-prefixed versions of comparison
        functions throughout.



Modified:
   branches/glib-2-16/gio/ChangeLog
   branches/glib-2-16/gio/xdgmime/xdgmime.c
   branches/glib-2-16/gio/xdgmime/xdgmimecache.c

Modified: branches/glib-2-16/gio/xdgmime/xdgmime.c
==============================================================================
--- branches/glib-2-16/gio/xdgmime/xdgmime.c	(original)
+++ branches/glib-2-16/gio/xdgmime/xdgmime.c	Wed Apr 16 17:56:38 2008
@@ -684,13 +684,11 @@
 }
 
 int
-xdg_mime_media_type_equal (const char *mime_a,
-			   const char *mime_b)
+_xdg_mime_media_type_equal (const char *mime_a,
+			    const char *mime_b)
 {
   char *sep;
 
-  xdg_mime_init ();
-
   sep = strchr (mime_a, '/');
   
   if (sep && strncmp (mime_a, mime_b, sep - mime_a + 1) == 0)
@@ -699,6 +697,15 @@
   return 0;
 }
 
+int
+xdg_mime_media_type_equal (const char *mime_a,
+			   const char *mime_b)
+{
+  xdg_mime_init ();
+
+  return _xdg_mime_media_type_equal (mime_a, mime_b);
+}
+
 #if 1
 static int
 xdg_mime_is_super_type (const char *mime)

Modified: branches/glib-2-16/gio/xdgmime/xdgmimecache.c
==============================================================================
--- branches/glib-2-16/gio/xdgmime/xdgmimecache.c	(original)
+++ branches/glib-2-16/gio/xdgmime/xdgmimecache.c	Wed Apr 16 17:56:38 2008
@@ -297,7 +297,7 @@
 	  for (n = 0; n < n_mime_types; n++)
 	    {
 	      if (mime_types[n] && 
-		  xdg_mime_mime_type_equal (mime_types[n], non_match))
+		  _xdg_mime_mime_type_equal (mime_types[n], non_match))
 		mime_types[n] = NULL;
 	    }
 	}
@@ -797,7 +797,7 @@
 #if 1
   /* Handle supertypes */
   if (is_super_type (ubase) &&
-      xdg_mime_media_type_equal (umime, ubase))
+      _xdg_mime_media_type_equal (umime, ubase))
     return 1;
 #endif
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]