[path] Do not accept NULL descriptions
authorEmmanuele Bassi <ebassi@linux.intel.com>
Fri, 20 Feb 2009 11:17:52 +0000 (11:17 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Fri, 20 Feb 2009 11:47:14 +0000 (11:47 +0000)
Bug 1465 - clutter_path_parse_description should check p==NULL

When accepting a stringified path description, ClutterPath methods
and the parser should not accept NULL or empty strings.

clutter/clutter-path.c

index c459cdf..43566d5 100644 (file)
@@ -568,8 +568,11 @@ static gboolean
 clutter_path_parse_description (const gchar  *p,
                                 GSList      **ret)
 {
-  GSList *nodes = NULL;
   ClutterPathNodeFull *node;
+  GSList *nodes = NULL;
+
+  if (p == NULL || *p == '\0')
+    return FALSE;
 
   while (TRUE)
     {
@@ -720,6 +723,7 @@ clutter_path_add_string (ClutterPath *path,
   GSList *nodes;
 
   g_return_val_if_fail (CLUTTER_IS_PATH (path), FALSE);
+  g_return_val_if_fail (str != NULL, FALSE);
 
   if (clutter_path_parse_description (str, &nodes))
     {
@@ -1099,11 +1103,13 @@ clutter_path_replace_node (ClutterPath           *path,
  * Since: 1.0
  */
 gboolean
-clutter_path_set_description (ClutterPath *path, const gchar *str)
+clutter_path_set_description (ClutterPath *path,
+                              const gchar *str)
 {
   GSList *nodes;
 
   g_return_val_if_fail (CLUTTER_IS_PATH (path), FALSE);
+  g_return_val_if_fail (str != NULL, FALSE);
 
   if (clutter_path_parse_description (str, &nodes))
     {