From 2b72214e5219c2e99dcc3a9891cf40d2e065c39a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Mon, 23 Sep 2013 18:19:16 +0200 Subject: [PATCH] platform: fix a crash when nm_platform_sysctl_get() returns NULL (rh #1010522) nm_platform_sysctl_get() can return NULL on an error (when file specified by 'path' argument doesn't exist, can't be opened, etc.) https://bugzilla.redhat.com/show_bug.cgi?id=1010522 --- src/platform/nm-linux-platform.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index b500465fc9..e2f64c915b 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -1946,12 +1946,16 @@ tun_get_properties (NMPlatform *platform, int ifindex, NMPlatformTunProperties * path = g_strdup_printf ("/sys/class/net/%s/group", ifname); val = nm_platform_sysctl_get (path); g_free (path); + if (!val) + return FALSE; props->group = strtoll (val, NULL, 10); g_free (val); path = g_strdup_printf ("/sys/class/net/%s/tun_flags", ifname); val = nm_platform_sysctl_get (path); g_free (path); + if (!val) + return FALSE; flags = strtoul (val, NULL, 16); props->mode = ((flags & TUN_TYPE_MASK) == TUN_TUN_DEV) ? "tun" : "tap"; props->no_pi = !!(flags & IFF_NO_PI);