From 3c49d1c02bf9e58272c8526b0a1714a544300466 Mon Sep 17 00:00:00 2001 From: Tedd Ho-Jeong An Date: Thu, 29 Nov 2018 15:24:26 -0800 Subject: [PATCH] tools/btpclient: Fix compile warning with strncpy This patch fixes the boundry warning-to-error in GCC 8.1.1 with strncpy. Change-Id: I606199afaa5de1dc56f043160b1f6a53f3092b81 Signed-off-by: himanshu --- tools/btpclient.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/btpclient.c b/tools/btpclient.c index 23a0a29..7299f65 100644 --- a/tools/btpclient.c +++ b/tools/btpclient.c @@ -383,8 +383,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.7.4