From: wu zheng Date: Thu, 15 Jan 2015 05:23:24 +0000 (+0800) Subject: Fix the error array value overflow X-Git-Tag: submit/accepted/tizen_common/20150115.053946^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=054330269e2959ba6cf645ab290a554e2364d2e2;p=platform%2Fupstream%2Fbluez.git Fix the error array value overflow The array value overflow in the print function of hcitool.c. Fix it. Change-Id: Ic920df935cffc1a4d192244adaaa86ec68fcd203 Signed-off-by: Wu Zheng --- diff --git a/tools/hcitool.c b/tools/hcitool.c index 722adcb..b63d9d5 100644 --- a/tools/hcitool.c +++ b/tools/hcitool.c @@ -2419,7 +2419,7 @@ static int print_advertising_devices(int dd, uint8_t filter_type) char addr_array[18]; char *addr = addr_array; - buf_array[HCI_MAX_EVENT_SIZE] = 0; + buf_array[HCI_MAX_EVENT_SIZE-1] = 0; while ((len = read(dd, buf, HCI_MAX_EVENT_SIZE)) < 0) { if (errno == EINTR && signal_received == SIGINT) { @@ -2452,8 +2452,7 @@ static int print_advertising_devices(int dd, uint8_t filter_type) eir_parse_name(info->data, info->length, name, 29); - addr_array[18] = '\0'; - name_array[30] = '\0'; + name_array[29] = '\0'; printf("%s %s\n", addr, name); } }