libnm: don't use g_strsplit_set() to search string for invalid characters
This commit is contained in:
@@ -168,7 +168,6 @@ nm_team_link_watcher_new_nsna_ping (gint init_wait,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
NMTeamLinkWatcher *watcher;
|
NMTeamLinkWatcher *watcher;
|
||||||
gs_strfreev gchar **strv = NULL;
|
|
||||||
const char *val_fail = NULL;
|
const char *val_fail = NULL;
|
||||||
|
|
||||||
if (!target_host) {
|
if (!target_host) {
|
||||||
@@ -177,8 +176,7 @@ nm_team_link_watcher_new_nsna_ping (gint init_wait,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strv = g_strsplit_set (target_host, " \\/\t=\"\'", 0);
|
if (strpbrk (target_host, " \\/\t=\"\'")) {
|
||||||
if (strv[1]) {
|
|
||||||
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
|
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
|
||||||
_("target-host '%s' contains invalid characters"), target_host);
|
_("target-host '%s' contains invalid characters"), target_host);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -236,7 +234,6 @@ nm_team_link_watcher_new_arp_ping (gint init_wait,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
NMTeamLinkWatcher *watcher;
|
NMTeamLinkWatcher *watcher;
|
||||||
gs_strfreev gchar **strv = NULL;
|
|
||||||
const char *val_fail = NULL;
|
const char *val_fail = NULL;
|
||||||
|
|
||||||
if (!target_host || !source_host) {
|
if (!target_host || !source_host) {
|
||||||
@@ -246,16 +243,13 @@ nm_team_link_watcher_new_arp_ping (gint init_wait,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strv = g_strsplit_set (target_host, " \\/\t=\"\'", 0);
|
if (strpbrk (target_host, " \\/\t=\"\'")) {
|
||||||
if (strv[1]) {
|
|
||||||
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
|
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
|
||||||
_("target-host '%s' contains invalid characters"), target_host);
|
_("target-host '%s' contains invalid characters"), target_host);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
g_strfreev (strv);
|
|
||||||
|
|
||||||
strv = g_strsplit_set (source_host, " \\/\t=\"\'", 0);
|
if (strpbrk (target_host, " \\/\t=\"\'")) {
|
||||||
if (strv[1]) {
|
|
||||||
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
|
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_FAILED,
|
||||||
_("source-host '%s' contains invalid characters"), source_host);
|
_("source-host '%s' contains invalid characters"), source_host);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Reference in New Issue
Block a user