From 592085025cdf70f2e9f55b1b724ac4acd87c30f9 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 19 Mar 2019 09:02:12 +0100 Subject: [PATCH] libnm: don't assert for valid string length in nm_setting_wired_add_s390_option() The setting's verify() function already checks that the s390 options are not empty and no longer than 200. Asserting for that is a major annoyance, because callers need to reimplement that check. --- libnm-core/nm-setting-wired.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libnm-core/nm-setting-wired.c b/libnm-core/nm-setting-wired.c index da786d21f0..7f0843046d 100644 --- a/libnm-core/nm-setting-wired.c +++ b/libnm-core/nm-setting-wired.c @@ -507,16 +507,11 @@ nm_setting_wired_add_s390_option (NMSettingWired *setting, const char *key, const char *value) { - size_t value_len; - g_return_val_if_fail (NM_IS_SETTING_WIRED (setting), FALSE); g_return_val_if_fail (key && key[0], FALSE); g_return_val_if_fail (g_strv_contains (valid_s390_opts, key), FALSE); g_return_val_if_fail (value != NULL, FALSE); - value_len = strlen (value); - g_return_val_if_fail (value_len > 0 && value_len < 200, FALSE); - g_hash_table_insert (NM_SETTING_WIRED_GET_PRIVATE (setting)->s390_options, g_strdup (key), g_strdup (value)); @@ -680,7 +675,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) g_hash_table_iter_init (&iter, priv->s390_options); while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value)) { if ( !g_strv_contains (valid_s390_opts, key) - || !strlen (value) + || value[0] == '\0' || (strlen (value) > 200)) { g_set_error (error, NM_CONNECTION_ERROR,