summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-06-07 13:10:38 +0200
committerThomas Haller <thaller@redhat.com>2016-06-15 10:32:32 +0200
commitc629378d2e91cbb49ad5c64925ef987e1ddd6593 (patch)
treed1f203961b73a396c3855565a76a5ec02d0e1238
parente108f1cfafb2d3de1849b82b04e44c4f1251395e (diff)
downloadNetworkManager-c629378d2e91cbb49ad5c64925ef987e1ddd6593.tar.gz
clients: fix potential crash due to wrong sort function
g_qsort_with_data() passes the pointers to the compared items to the compare function, that is not the "const char *" pointers itself. Fixes: 41976e30690d36cc3998c5025ac70c8cbaa8f897
-rw-r--r--clients/common/nm-vpn-helpers.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/clients/common/nm-vpn-helpers.c b/clients/common/nm-vpn-helpers.c
index 43ac4b2e61..eb0f3af131 100644
--- a/clients/common/nm-vpn-helpers.c
+++ b/clients/common/nm-vpn-helpers.c
@@ -95,12 +95,6 @@ nm_vpn_get_plugins (void)
return plugins;
}
-static int
-_strcmp_data (gconstpointer a, gconstpointer b, gpointer unused)
-{
- return strcmp (a, b);
-}
-
const char **
nm_vpn_get_plugin_names (gboolean only_available_plugins)
{
@@ -132,7 +126,7 @@ nm_vpn_get_plugin_names (gboolean only_available_plugins)
list[i++] = known_names[j];
}
- g_qsort_with_data (list, i, sizeof (gpointer), _strcmp_data, NULL);
+ g_qsort_with_data (list, i, sizeof (gpointer), nm_strcmp_p_with_data, NULL);
/* remove duplicates */
for (k = 0, j = 1; j < i; j++) {