diff options
author | Thomas Haller <thaller@redhat.com> | 2021-06-05 16:55:04 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-06-08 08:24:14 +0200 |
commit | 07002f73206dae39f906e6fae6e7c6ca79670c36 (patch) | |
tree | 2417994dba9a03126dd09521d6ecd7d905dfce9f | |
parent | 2b2c818e033585d34afaa4aede059be129dae0ba (diff) | |
download | NetworkManager-07002f73206dae39f906e6fae6e7c6ca79670c36.tar.gz |
core: remove _nul_sentinel from UuidData struct
The user really must not treat UuidData.bin as a NUL terminated string.
The _nul_sentinel is not necessary. And if by chance the user makes this
fatal mistake, then UuidData.str will still be there to NUL terminate the
buffer, the content is garbage either way.
Remove the sentinel.
-rw-r--r-- | src/core/nm-core-utils.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/core/nm-core-utils.c b/src/core/nm-core-utils.c index bb2471c6a4..13400f4be2 100644 --- a/src/core/nm-core-utils.c +++ b/src/core/nm-core-utils.c @@ -2377,8 +2377,6 @@ out: typedef struct { NMUuid bin; - char - _nul_sentinel; /* just for safety, if somebody accidentally uses the binary in a string context. */ /* depending on whether the string is packed or not (with/without hyphens), * it's 32 or 36 characters long (plus the trailing NUL). @@ -2396,9 +2394,8 @@ _uuid_data_init(UuidData *uuid_data, gboolean packed, gboolean is_fake, const NM nm_assert(uuid_data); nm_assert(uuid); - uuid_data->bin = *uuid; - uuid_data->_nul_sentinel = '\0'; - uuid_data->is_fake = is_fake; + uuid_data->bin = *uuid; + uuid_data->is_fake = is_fake; if (packed) { G_STATIC_ASSERT_EXPR(sizeof(uuid_data->str) >= (sizeof(*uuid) * 2 + 1)); nm_utils_bin2hexstr_full(uuid, sizeof(*uuid), '\0', FALSE, uuid_data->str); |