diff options
author | Thomas Haller <thaller@redhat.com> | 2017-05-23 16:39:08 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2017-05-23 16:51:07 +0200 |
commit | 4e6dced5a07db749a3ec1d6848bbb6be336cd22f (patch) | |
tree | 7f46f559e04ad6cddcd059b39234f10ddc1f142e | |
parent | ee96001f3cd528291781bd0b55e8ede313b9e28e (diff) |
clients: fix appending integer to result in nmc_property_set_bytes()nm-1-0
(cherry picked from commit d76c190dc72df042733cca13849e18bcc13eed65)
(cherry picked from commit 06d3c95e4fc70561b12be80e5982487443d914ec)
(cherry picked from commit fb9c302af7b1af3f06bca573c951800626be757e)
(cherry picked from commit 8b4c1cddfed4017dbab0a2ac956e52f21790b46c)
-rw-r--r-- | clients/cli/settings.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clients/cli/settings.c b/clients/cli/settings.c index 0e5e98740..423b265c1 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -2538,13 +2538,16 @@ nmc_property_set_bytes (NMSetting *setting, const char *prop, const char *val, G strv = nmc_strsplit_set (val_strip, delimiters, 0); array = g_byte_array_sized_new (g_strv_length (strv)); for (iter = strv; iter && *iter; iter++) { + guint8 v8; + if (!nmc_string_to_int_base (g_strstrip (*iter), 16, TRUE, 0, 255, &val_int)) { g_set_error (error, 1, 0, _("'%s' is not a valid hex character"), *iter); g_byte_array_free (array, TRUE); success = FALSE; goto done; } - g_byte_array_append (array, (const guint8 *) &val_int, 1); + v8 = val_int; + g_byte_array_append (array, &v8, 1); } bytes = g_byte_array_free_to_bytes (array); |