mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 11:30:12 +01:00
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.
This commit is contained in:
parent
2b2c818e03
commit
07002f7320
1 changed files with 2 additions and 5 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue