diff options
author | Thomas Haller <thaller@redhat.com> | 2016-09-27 11:21:44 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-09-27 11:24:47 +0200 |
commit | 1b8c201cce0bf60fd465519ca4295780568c226a (patch) | |
tree | 30ec7cf5f9ea07c89a31a744de7490e27203b7a1 /clients | |
parent | c2ef5da42a38d17588fb2591ce790e3daf87aac4 (diff) | |
download | NetworkManager-1b8c201cce0bf60fd465519ca4295780568c226a.tar.gz |
cli: reject team.config from files with '\0'
The team-config must be valid utf-8. First of all, JSON
is also defined for other unicode encodings, but libjansson
can only handle utf-8. So, just require that.
A file with a '\0' truncates part of the file and is thus
invalid.
Diffstat (limited to 'clients')
-rw-r--r-- | clients/cli/common.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c index 22e750475b..efe41cc6e4 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -871,6 +871,12 @@ nmc_team_check_config (const char *config, char **out_config, GError **error) return FALSE; } } else { + if (c_len != strlen (contents)) { + g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT, + _("team config file '%s' contains non-valid utf-8"), + config); + return FALSE; + } filename = config; config = config_clone = g_steal_pointer (&contents); } |