From 736857d8a8326a65a6285635524c2b0131a2cc13 Mon Sep 17 00:00:00 2001 From: wu zheng Date: Wed, 14 Jan 2015 15:13:47 +0800 Subject: [PATCH] Fix the length of string When string is char *, the length need to be set. Change-Id: I8659442afe939af56ca0fe224cf145012197e8ba Signed-off-by: Wu Zheng --- tools/hcitool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/hcitool.c b/tools/hcitool.c index ee810e5..da38052 100644 --- a/tools/hcitool.c +++ b/tools/hcitool.c @@ -2444,11 +2444,11 @@ static int print_advertising_devices(int dd, uint8_t filter_type) char name_array[30]; char *name = name_array; - memset(name, 0, sizeof(name)); + memset(name, 0, 30); ba2str(&info->bdaddr, addr); eir_parse_name(info->data, info->length, - name, sizeof(name) - 1); + name, 29); printf("%s %s\n", addr, name); } -- 2.7.4