When parsing DBus messages to Domains.Configuration, remove all empty
strings from input. For example, sending
" example.com   foo.example.com " will result in
Domains.Configuration containing [ example.com, foo.example.com ],
rather than [ , example.com, , , foo.example.com, ].
---
 src/service.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/service.c b/src/service.c
index 1723586..37f8fb9 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3387,17 +3387,22 @@ static DBusMessage *set_property(DBusConnection *conn,
                        const char *val;
                        dbus_message_iter_get_basic(&entry, &val);
                        dbus_message_iter_next(&entry);
-                       if (str->len > 0)
-                               g_string_append_printf(str, " %s", val);
-                       else
-                               g_string_append(str, val);
+                       if(!val[0]) {
+                               if (str->len > 0)
+                                       g_string_append_printf(str, " %s", val);
+                               else
+                                       g_string_append(str, val);
+                       }
                }
 
                searchdomain_remove_all(service);
                g_strfreev(service->domains);
 
-               if (str->len > 0)
-                       service->domains = g_strsplit_set(str->str, " ", 0);
+               if (str->len > 0) {
+                       char **domains = g_strsplit_set(str->str, " ", 0);
+                       domains = remove_empty_strings(domains);
+                       service->domains = domains;
+               }
                else
                        service->domains = NULL;
 
-- 
2.1.0

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to