diff options
author | Thomas Haller <thaller@redhat.com> | 2017-05-20 16:49:30 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-05-23 13:27:24 +0200 |
commit | d76c190dc72df042733cca13849e18bcc13eed65 (patch) | |
tree | b6597582072e21a8703b3bb66abb3b85226335fe /clients | |
parent | 30393ee2360e8678188cc47d794f2199d50e82ba (diff) | |
download | NetworkManager-d76c190dc72df042733cca13849e18bcc13eed65.tar.gz |
clients: fix appending integer to result in nmc_property_set_bytes()
Diffstat (limited to 'clients')
-rw-r--r-- | clients/common/nm-meta-setting-desc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 41beb3f0ca..408fc99178 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -1725,13 +1725,16 @@ nmc_property_set_bytes (NMSetting *setting, const char *prop, const char *value, 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); |