@@ -731,7 +731,7 @@ static void create_net_setup(struct l_dbus_message *msg, void *user_data)
struct l_dbus_message_builder *builder;
/* Generate random UUID */
- l_getrandom(app.uuid, sizeof(app.uuid));
+ l_uuid_v4(app.uuid);
builder = l_dbus_message_builder_new(msg);
@@ -899,7 +899,7 @@ static void cmd_import_node(int argc, char *argv[])
/* Device UUID */
req->data1 = l_util_from_hexstring(argv[1], &sz);
- if (!req->data1 || sz != 16) {
+ if (!req->data1 || sz != 16 || !l_uuid_is_valid(req->data1)) {
l_error("Failed to generate UUID array from %s", argv[1]);
goto fail;
}
@@ -1298,7 +1298,7 @@ static void add_node_setup(struct l_dbus_message *msg, void *user_data)
struct l_dbus_message_builder *builder;
uuid = l_util_from_hexstring(str, &sz);
- if (!uuid || sz != 16) {
+ if (!uuid || sz != 16 || !l_uuid_is_valid(uuid)) {
l_error("Failed to generate UUID array from %s", str);
return;
}
@@ -1407,7 +1407,7 @@ bool mesh_db_create(const char *fname, const uint8_t token[8],
if (!add_u8_8(jcfg, "token", token))
goto fail;
- l_getrandom(uuid, 16);
+ l_uuid_v4(uuid);
if (!add_u8_16(jcfg, "uuid", uuid))
goto fail;