[Xfce4-commits] r29445 - in libxfce4menu/trunk: . libxfce4menu

Jannis Pohlmann jannis at xfce.org
Wed Feb 4 00:05:07 CET 2009


Author: jannis
Date: 2009-02-03 23:05:07 +0000 (Tue, 03 Feb 2009)
New Revision: 29445

Modified:
   libxfce4menu/trunk/COPYING
   libxfce4menu/trunk/ChangeLog
   libxfce4menu/trunk/configure.in.in
   libxfce4menu/trunk/libxfce4menu/xfce-menu.c
Log:
	* COPYING: Add "no invariant sections" hint to the GFDL.
	* configure.in.in: Post-release version bump.
	* libxfce4mixer/xfce-menu.c: Fix crash when reading invalid menu files
	  with characters outside the root <Menu> element. Of course this even
	  works with documents which have no <Menu> element at all.

Modified: libxfce4menu/trunk/COPYING
===================================================================
--- libxfce4menu/trunk/COPYING	2009-02-03 22:47:44 UTC (rev 29444)
+++ libxfce4menu/trunk/COPYING	2009-02-03 23:05:07 UTC (rev 29445)
@@ -1,6 +1,6 @@
 libxfce4menu's source code is licensed under the LGPLv2,
-while its documentation is licensed under the GFDL 1.1.
-The text of both licenses follow:
+while its documentation is licensed under the GFDL 1.1 (with no 
+invariant sections). The text of both licenses follow:
 
 		  GNU LIBRARY GENERAL PUBLIC LICENSE
 		       Version 2, June 1991

Modified: libxfce4menu/trunk/ChangeLog
===================================================================
--- libxfce4menu/trunk/ChangeLog	2009-02-03 22:47:44 UTC (rev 29444)
+++ libxfce4menu/trunk/ChangeLog	2009-02-03 23:05:07 UTC (rev 29445)
@@ -1,3 +1,11 @@
+2009-02-04	Jannis Pohlmann <jannis at xfce.org>
+
+	* COPYING: Add "no invariant sections" hint to the GFDL.
+	* configure.in.in: Post-release version bump.
+	* libxfce4mixer/xfce-menu.c: Fix crash when reading invalid menu files
+	  with characters outside the root <Menu> element. Of course this even
+	  works with documents which have no <Menu> element at all.
+
 2009-01-25	Jannis Pohlmann <jannis at xfce.org>
 
 	* == 4.5.99.1 released! ==

Modified: libxfce4menu/trunk/configure.in.in
===================================================================
--- libxfce4menu/trunk/configure.in.in	2009-02-03 22:47:44 UTC (rev 29444)
+++ libxfce4menu/trunk/configure.in.in	2009-02-03 23:05:07 UTC (rev 29445)
@@ -17,7 +17,7 @@
 m4_define([libxfce4menu_version_micro], [99])
 m4_define([libxfce4menu_version_nano], [1])
 m4_define([libxfce4menu_version_build], [r at REVISION@])
-m4_define([libxfce4menu_version_tag], [])
+m4_define([libxfce4menu_version_tag], [svn])
 m4_define([libxfce4menu_version], [libxfce4menu_version_major().libxfce4menu_version_minor().libxfce4menu_version_micro()ifelse(libxfce4menu_version_nano(), [], [], [.libxfce4menu_version_nano()])ifelse(libxfce4menu_version_tag(), [svn], [libxfce4menu_version_tag()-libxfce4menu_version_build()], [libxfce4menu_version_tag()])])
 
 dnl ********************************************

Modified: libxfce4menu/trunk/libxfce4menu/xfce-menu.c
===================================================================
--- libxfce4menu/trunk/libxfce4menu/xfce-menu.c	2009-02-03 22:47:44 UTC (rev 29444)
+++ libxfce4menu/trunk/libxfce4menu/xfce-menu.c	2009-02-03 23:05:07 UTC (rev 29445)
@@ -1167,7 +1167,8 @@
 
 
 static gboolean
-xfce_menu_load (XfceMenu *menu, GError **error)
+xfce_menu_load (XfceMenu *menu, 
+                GError  **error)
 {
   /* Parser structure (connect handlers etc.) */
   GMarkupParseContext *context;
@@ -1216,7 +1217,8 @@
   context = g_markup_parse_context_new (&parser, 0, &menu_context, NULL);
 
   /* Try to parse the menu file */
-  if (!g_markup_parse_context_parse (context, contents, contents_length, error) || !g_markup_parse_context_end_parse (context, error))
+  if (!g_markup_parse_context_parse (context, contents, contents_length, error) || 
+      !g_markup_parse_context_end_parse (context, error))
     {
       g_markup_parse_context_free (context);
       return FALSE;
@@ -1614,12 +1616,20 @@
                       GError             **error)
 {
   XfceMenuParseContext *menu_context = (XfceMenuParseContext *)user_data;
-  XfceMenu             *current_menu = g_list_first (menu_context->menu_stack)->data;
+  XfceMenu             *current_menu = NULL;
   XfceMenuRules        *current_rule = NULL;
+  gchar                *content;
 
-  /* Generate NULL-terminated string */
-  gchar *content = g_strndup (text, text_len);
+  /* Ignore characters outside of the root <Menu> element */
+  if (G_UNLIKELY (g_list_length (menu_context->menu_stack) == 0))
+    return;
 
+  /* Get the current menu */
+  current_menu = g_list_first (menu_context->menu_stack)->data;
+
+  /* Generate NUL-terminated string */
+  content = g_strndup (text, text_len);
+
   /* Fetch current rule from stack (if possible) */
   if (g_list_length (menu_context->rule_stack) > 0)
     current_rule = g_list_first (menu_context->rule_stack)->data;




More information about the Xfce4-commits mailing list