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

diff --git a/src/service.c b/src/service.c
index b14ddf7..7b9f8f3 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3056,20 +3056,24 @@ static int update_proxy_configuration(struct 
connman_service *service,
                if (servers_str) {
                        g_strfreev(service->proxies);
 
-                       if (servers_str->len > 0)
-                               service->proxies = g_strsplit_set(
+                       if (servers_str->len > 0) {
+                               char **proxies = g_strsplit_set(
                                        servers_str->str, " ", 0);
-                       else
+                               proxies = remove_empty_strings(proxies);
+                               service->proxies = proxies;
+                       } else
                                service->proxies = NULL;
                }
 
                if (excludes_str) {
                        g_strfreev(service->excludes);
 
-                       if (excludes_str->len > 0)
-                               service->excludes = g_strsplit_set(
+                       if (excludes_str->len > 0) {
+                               char **excludes = g_strsplit_set(
                                        excludes_str->str, " ", 0);
-                       else
+                               excludes = remove_empty_strings(excludes);
+                               service->excludes = excludes;
+                       } else
                                service->excludes = NULL;
                }
 
-- 
2.1.0

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

Reply via email to