Blob Blame History Raw
From cecdf233da4ebb1006a635e19018ded22d892914 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 9 Sep 2016 01:11:53 +0200
Subject: [PATCH 1/1] libnm-core: fix crash in
 nm_vpn_plugin_info_list_get_service_types()

Coverity says, "Dereference after null check". Indeed, @aliases
is usually NULL.

Fixes: 46665898bbe2c0998529cb75056d674654ba41a9
(cherry picked from commit 9cf9c3a88ed896df9133d41bac7065069bf49909)
(cherry picked from commit 4a535e6213bb5de05f166c29debc65fc04a7a3b8)
---
 libnm-core/nm-vpn-plugin-info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libnm-core/nm-vpn-plugin-info.c b/libnm-core/nm-vpn-plugin-info.c
index a472761..d3bc489 100644
--- a/libnm-core/nm-vpn-plugin-info.c
+++ b/libnm-core/nm-vpn-plugin-info.c
@@ -738,7 +738,7 @@ nm_vpn_plugin_info_list_get_service_types (GSList *list,
 			n = _service_type_get_default_abbreviation (priv->service);
 			if (n)
 				g_ptr_array_add (l, g_strdup (n));
-			for (i = 0; priv->aliases[i]; i++) {
+			for (i = 0; priv->aliases && priv->aliases[i]; i++) {
 				n = _service_type_get_default_abbreviation (priv->aliases[i]);
 				if (n)
 					g_ptr_array_add (l, g_strdup (n));
-- 
2.7.4