[PATCH] tools/btpclient: Fix compile warning with strncpy

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

 



This patch fixes the boundry warning-to-error in GCC 8.1.1 with strncpy.
---
 tools/btpclient.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/btpclient.c b/tools/btpclient.c
index b217df58f..e77720ed1 100644
--- a/tools/btpclient.c
+++ b/tools/btpclient.c
@@ -376,8 +376,8 @@ static void btp_gap_read_info(uint8_t index, const void *param, uint16_t length,
 		goto failed;
 	}
 
-	strncpy((char *) rp.name, str, sizeof(rp.name));
-	strncpy((char *) rp.short_name, str, sizeof(rp.short_name));
+	snprintf((char *)rp.name, sizeof(rp.name), "%s", str);
+	snprintf((char *)rp.short_name, sizeof(rp.short_name), "%s", str);
 	rp.supported_settings = L_CPU_TO_LE32(adapter->supported_settings);
 	rp.current_settings = L_CPU_TO_LE32(adapter->current_settings);
 
-- 
2.17.2




[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