[PATCH BlueZ 1/3] mesh: Fix using uninitialized bytes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fixes two problems found with static analysis
---
 mesh/crypto.c | 1 +
 mesh/node.c   | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/mesh/crypto.c b/mesh/crypto.c
index 99536594b..70b96c51b 100644
--- a/mesh/crypto.c
+++ b/mesh/crypto.c
@@ -553,6 +553,7 @@ bool mesh_crypto_packet_build(bool ctl, uint8_t ttl,
 	if (seq > SEQ_MASK)
 		return false;
 
+	packet[0] = 0;
 	l_put_be32(seq, packet + 1);
 	packet[1] = (ctl ? CTL : 0) | (ttl & TTL_MASK);
 
diff --git a/mesh/node.c b/mesh/node.c
index dd28dfd77..49ba7c885 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -1596,6 +1596,8 @@ static void get_managed_objects_cb(struct l_dbus_message *msg, void *user_data)
 		/* Generate device and primary network keys */
 		l_getrandom(dev_key, sizeof(dev_key));
 		l_getrandom(net_key.old_key, sizeof(net_key.old_key));
+		memcpy(net_key.new_key, net_key.old_key,
+						sizeof(net_key.old_key));
 		net_key.net_idx = PRIMARY_NET_IDX;
 		net_key.phase = KEY_REFRESH_PHASE_NONE;
 
-- 
2.25.4




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux