From c629378d2e91cbb49ad5c64925ef987e1ddd6593 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 7 Jun 2016 13:10:38 +0200 Subject: [PATCH] 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 --- clients/common/nm-vpn-helpers.c | 8 +------- 1 file changed, 1 insertion(+), 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++) {