connman_inet_ifname() may return a NULL pointer e.g. if the interface
does not exist in the kernel anymore but connman isn't yet aware of
that. Passing a NULL pointer to D-Bus may result in an abort, so check
the return value.
---
src/ipconfig.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/ipconfig.c b/src/ipconfig.c
index b7e4f94..fa4c0d6 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -2166,9 +2166,11 @@ void __connman_ipconfig_append_ethernet(struct
connman_ipconfig *ipconfig,
if (ipconfig->index >= 0) {
char *ifname = connman_inet_ifname(ipconfig->index);
- connman_dbus_dict_append_basic(iter, "Interface",
- DBUS_TYPE_STRING, &ifname);
- g_free(ifname);
+ if (ifname) {
+ connman_dbus_dict_append_basic(iter, "Interface",
+ DBUS_TYPE_STRING, &ifname);
+ g_free(ifname);
+ }
}
if (ipdevice->address)
--
1.9.1
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman