From 1b8c201cce0bf60fd465519ca4295780568c226a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 27 Sep 2016 11:21:44 +0200 Subject: 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. --- clients/cli/common.c | 6 ++++++ libnm/libnm.ver | 1 + 2 files changed, 7 insertions(+) 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); } diff --git a/libnm/libnm.ver b/libnm/libnm.ver index bc47e8625d..bfd15b0b9e 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1085,6 +1085,7 @@ global: } libnm_1_2_0; libnm_1_6_0 { +global: nm_capability_get_type; nm_utils_is_json_object; } libnm_1_4_0; -- cgit v1.2.1