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: 41976e3069
This commit is contained in:
Thomas Haller 2016-06-07 13:10:38 +02:00
parent e108f1cfaf
commit c629378d2e

View file

@ -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++) {