From d30e39527496a99187eca5ed5b0fc393f48479a4 Mon Sep 17 00:00:00 2001 From: Druco Date: Mon, 20 Aug 2018 23:05:00 -0700 Subject: [PATCH] Fix so Allowed IPs can have a ", " between elements. --- shared/import-export.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shared/import-export.c b/shared/import-export.c index 9d0ecda..07b8a61 100644 --- a/shared/import-export.c +++ b/shared/import-export.c @@ -1222,7 +1222,11 @@ create_config_string (NMConnection *connection, GError **error) ip_list = g_strsplit_set (allowed_ips, " \t,", 0); ips = g_array_new(TRUE, TRUE, sizeof(char *)); for (ip_iter = ip_list; ip_iter && *ip_iter; ip_iter++) { - g_array_append_val(ips, *ip_iter); + // Using the g_strsplit_set call above can create zero length array elements if + // there is multiple separators such as both a comma and a space so we need to + // ignore any 0 length strings + if (0 != strlen(*ip_iter)) + g_array_append_val(ips, *ip_iter); } allowed_ips = concatenate_strings(ips, ", ");