summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-12-08 10:09:01 +0100
committerThomas Haller <thaller@redhat.com>2017-12-08 11:09:34 +0100
commit6c93e32212f9901e882d5a9ca221d037162bc740 (patch)
tree7fda0bfa82e04c29d298d485daaf539384a54023
parent79d5a06c8b307c56e663dc9ed914b34e860cd2bf (diff)
downloadNetworkManager-6c93e32212f9901e882d5a9ca221d037162bc740.tar.gz
libnm: don't use g_strsplit_set() to search string for invalid characters
-rw-r--r--libnm-core/nm-setting-team.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/libnm-core/nm-setting-team.c b/libnm-core/nm-setting-team.c
index 7c2b8caa06..7f38dd2559 100644
--- a/libnm-core/nm-setting-team.c
+++ b/libnm-core/nm-setting-team.c
@@ -168,7 +168,6 @@ nm_team_link_watcher_new_nsna_ping (gint init_wait,
GError **error)
{
NMTeamLinkWatcher *watcher;
- gs_strfreev gchar **strv = NULL;
const char *val_fail = NULL;
if (!target_host) {
@@ -177,8 +176,7 @@ nm_team_link_watcher_new_nsna_ping (gint init_wait,
return NULL;
}
- strv = g_strsplit_set (target_host, " \\/\t=\"\'", 0);
- if (strv[1]) {
+ if (strpbrk (target_host, " \\/\t=\"\'")) {
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
_("target-host '%s' contains invalid characters"), target_host);
return NULL;
@@ -236,7 +234,6 @@ nm_team_link_watcher_new_arp_ping (gint init_wait,
GError **error)
{
NMTeamLinkWatcher *watcher;
- gs_strfreev gchar **strv = NULL;
const char *val_fail = NULL;
if (!target_host || !source_host) {
@@ -246,16 +243,13 @@ nm_team_link_watcher_new_arp_ping (gint init_wait,
return NULL;
}
- strv = g_strsplit_set (target_host, " \\/\t=\"\'", 0);
- if (strv[1]) {
+ if (strpbrk (target_host, " \\/\t=\"\'")) {
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
_("target-host '%s' contains invalid characters"), target_host);
return NULL;
}
- g_strfreev (strv);
- strv = g_strsplit_set (source_host, " \\/\t=\"\'", 0);
- if (strv[1]) {
+ if (strpbrk (target_host, " \\/\t=\"\'")) {
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
_("source-host '%s' contains invalid characters"), source_host);
return NULL;