diff --git a/browser-plugin/browser-plugin.c b/browser-plugin/browser-plugin.c index 385550c34..e9f99502b 100644 --- a/browser-plugin/browser-plugin.c +++ b/browser-plugin/browser-plugin.c @@ -455,7 +455,7 @@ plugin_enable_extension (PluginObject *obj, NPString uuid, gboolean enabled) { - const gchar *uuid_str = uuid.UTF8Characters; + gchar *uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); if (!uuid_is_valid (uuid_str)) return FALSE; @@ -468,6 +468,8 @@ plugin_enable_extension (PluginObject *obj, NULL, /* callback */ NULL /* user_data */); + g_free (uuid_str); + return TRUE; } @@ -476,7 +478,7 @@ plugin_install_extension (PluginObject *obj, NPString uuid, NPString version_tag) { - const gchar *uuid_str = uuid.UTF8Characters; + gchar *uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); if (!uuid_is_valid (uuid_str)) return FALSE; @@ -491,6 +493,8 @@ plugin_install_extension (PluginObject *obj, NULL, /* callback */ NULL /* user_data */); + g_free (uuid_str); + return TRUE; } @@ -501,9 +505,9 @@ plugin_uninstall_extension (PluginObject *obj, { GError *error = NULL; GVariant *res; - const gchar *uuid_str; + gchar *uuid_str; - uuid_str = uuid.UTF8Characters; + uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); if (!uuid_is_valid (uuid_str)) return FALSE; @@ -516,6 +520,8 @@ plugin_uninstall_extension (PluginObject *obj, NULL, /* cancellable */ &error); + g_free (uuid_str); + if (!res) { g_warning ("Failed to uninstall extension: %s", error->message); @@ -533,9 +539,9 @@ plugin_get_info (PluginObject *obj, { GError *error = NULL; GVariant *res; - const gchar *uuid_str; + gchar *uuid_str; - uuid_str = uuid.UTF8Characters; + uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); if (!uuid_is_valid (uuid_str)) return FALSE; @@ -547,6 +553,8 @@ plugin_get_info (PluginObject *obj, NULL, /* cancellable */ &error); + g_free (uuid_str); + if (!res) { g_warning ("Failed to retrieve extension metadata: %s", error->message); @@ -564,9 +572,9 @@ plugin_get_errors (PluginObject *obj, { GError *error = NULL; GVariant *res; - const gchar *uuid_str; + gchar *uuid_str; - uuid_str = uuid.UTF8Characters; + uuid_str = g_strndup (uuid.UTF8Characters, uuid.UTF8Length); if (!uuid_is_valid (uuid_str)) return FALSE; @@ -578,6 +586,8 @@ plugin_get_errors (PluginObject *obj, NULL, /* cancellable */ &error); + g_free (uuid_str); + if (!res) { g_warning ("Failed to retrieve errors: %s", error->message);