diff mbox series

[BlueZ,v1,2/2] mesh: Fix build errors when compiling on fc42

Message ID 20250417202113.80496-2-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v1,1/2] shared/shell: Fix build errors in fc42 | expand

Commit Message

Luiz Augusto von Dentz April 17, 2025, 8:21 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

./mesh/crypto.c: In function ‘mesh_crypto_device_key’:
./mesh/crypto.c:436:33: error: initializer-string for array of ‘unsigned char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (5 chars into 4 available) [-Werror=unterminated-string-initialization]
  436 |         const uint8_t prdk[4] = "prdk";
      |                                 ^~~~~~
---
 mesh/crypto.c            | 8 ++++----
 tools/mesh-gatt/crypto.c | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/mesh/crypto.c b/mesh/crypto.c
index b7607bb83794..ab44baee3427 100644
--- a/mesh/crypto.c
+++ b/mesh/crypto.c
@@ -371,7 +371,7 @@  bool mesh_crypto_session_key(const uint8_t secret[32],
 					const uint8_t salt[16],
 					uint8_t session_key[16])
 {
-	const uint8_t prsk[4] = "prsk";
+	const uint8_t prsk[4] = { 'p', 'r', 's', 'k' };
 
 	if (!aes_cmac_one(salt, secret, 32, session_key))
 		return false;
@@ -383,7 +383,7 @@  bool mesh_crypto_nonce(const uint8_t secret[32],
 					const uint8_t salt[16],
 					uint8_t nonce[13])
 {
-	const uint8_t prsn[4] = "prsn";
+	const uint8_t prsn[4] = { 'p', 'r', 's', 'n' };
 	uint8_t tmp[16];
 	bool result;
 
@@ -421,7 +421,7 @@  bool mesh_crypto_prov_conf_key(const uint8_t secret[32],
 					const uint8_t salt[16],
 					uint8_t conf_key[16])
 {
-	const uint8_t prck[4] = "prck";
+	const uint8_t prck[4] = { 'p', 'r', 'c', 'k' };
 
 	if (!aes_cmac_one(salt, secret, 32, conf_key))
 		return false;
@@ -433,7 +433,7 @@  bool mesh_crypto_device_key(const uint8_t secret[32],
 						const uint8_t salt[16],
 						uint8_t device_key[16])
 {
-	const uint8_t prdk[4] = "prdk";
+	const uint8_t prdk[4] = { 'p', 'r', 'd', 'k' };
 
 	if (!aes_cmac_one(salt, secret, 32, device_key))
 		return false;
diff --git a/tools/mesh-gatt/crypto.c b/tools/mesh-gatt/crypto.c
index c65974bb02d0..0dc796f004df 100644
--- a/tools/mesh-gatt/crypto.c
+++ b/tools/mesh-gatt/crypto.c
@@ -902,7 +902,7 @@  bool mesh_crypto_session_key(const uint8_t secret[32],
 					const uint8_t salt[16],
 					uint8_t session_key[16])
 {
-	const uint8_t prsk[4] = "prsk";
+	const uint8_t prsk[4] = { 'p', 'r', 's', 'k' };
 
 	if (!aes_cmac_one(salt, secret, 32, session_key))
 		return false;
@@ -914,7 +914,7 @@  bool mesh_crypto_nonce(const uint8_t secret[32],
 					const uint8_t salt[16],
 					uint8_t nonce[13])
 {
-	const uint8_t prsn[4] = "prsn";
+	const uint8_t prsn[4] = { 'p', 'r', 's', 'n' };
 	uint8_t tmp[16];
 	bool result;
 
@@ -955,7 +955,7 @@  bool mesh_crypto_prov_conf_key(const uint8_t secret[32],
 					const uint8_t salt[16],
 					uint8_t conf_key[16])
 {
-	const uint8_t prck[4] = "prck";
+	const uint8_t prck[4] = { 'p', 'r', 'c', 'k' };
 
 	if (!aes_cmac_one(salt, secret, 32, conf_key))
 		return false;
@@ -967,7 +967,7 @@  bool mesh_crypto_device_key(const uint8_t secret[32],
 						const uint8_t salt[16],
 						uint8_t device_key[16])
 {
-	const uint8_t prdk[4] = "prdk";
+	const uint8_t prdk[4] = { 'p', 'r', 'd', 'k' };
 
 	if (!aes_cmac_one(salt, secret, 32, device_key))
 		return false;