libnm: reject too large team-config JSON

This commit is contained in:
Thomas Haller 2016-09-23 11:16:48 +02:00
parent 32f78ae6c3
commit 146e0d23bc
2 changed files with 20 additions and 0 deletions

View file

@ -117,6 +117,16 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
}
if (priv->config) {
if (strlen (priv->config) > 1*1024*1024) {
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("team config exceeds size limit"));
g_prefix_error (error,
"%s.%s: ",
NM_SETTING_TEAM_PORT_SETTING_NAME,
NM_SETTING_TEAM_PORT_CONFIG);
return FALSE;
}
if (!nm_utils_is_json_object (priv->config, error)) {
g_prefix_error (error,
"%s.%s: ",

View file

@ -89,6 +89,16 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
if (priv->config) {
if (strlen (priv->config) > 1*1024*1024) {
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("team config exceeds size limit"));
g_prefix_error (error,
"%s.%s: ",
NM_SETTING_TEAM_SETTING_NAME,
NM_SETTING_TEAM_CONFIG);
return FALSE;
}
if (!nm_utils_is_json_object (priv->config, error)) {
g_prefix_error (error,
"%s.%s: ",