Re: [PATCH 3/7] [grl-plugin-registry] Get plugins' info from XML file



On Fri, 2010-06-11 at 21:38 +0200, Joaquim Rocha wrote: 
> +static gchar *
> +get_xml_path_from_plugin_path (const gchar *path)
> +{
> +  gchar *path_prefix, *xml_path, *extension;
> +  gint extension_index;
> +
> +  extension = g_strrstr (path, G_MODULE_SUFFIX);
> +  if (!extension) {
> +    return g_strdup (path);
> +  }
> +
> +  extension_index = g_utf8_pointer_to_offset (path, extension);
> +  path_prefix = (gchar *) g_malloc(extension - path);
> +  g_utf8_strncpy (path_prefix,
> +		  path,
> +		  extension_index);
> +  xml_path =  g_strconcat (path_prefix, "xml", NULL);
> +  g_free (path_prefix);
> +
> +  return xml_path;
> +}

This function is wrong.

It crashes test-ui when running without installing it.

Valgrind is complaining about an invalid write in g_utf8_strncpy()
function.

	J.A.




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