summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwu zheng <wu.zheng@intel.com>2015-01-15 17:42:17 +0800
committerwu zheng <wu.zheng@intel.com>2015-01-15 17:42:17 +0800
commitccb69ca94573c9863fe6324d77dae73ef7c01393 (patch)
tree9ae0e9177310d6e6cd92ca0725c8c4662f675c18
parent054330269e2959ba6cf645ab290a554e2364d2e2 (diff)
downloadbluez-tizen_3.0.2014.q4_common.tar.gz
bluez-tizen_3.0.2014.q4_common.tar.bz2
bluez-tizen_3.0.2014.q4_common.zip
Fix null terminated issues need to set length+1. Change-Id: I239c424dc47d6578f2d5845aeff1e88821fd5ff2 Signed-off-by: Wu Zheng <wu.zheng@intel.com>
-rw-r--r--tools/hcitool.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/hcitool.c b/tools/hcitool.c
index b63d9d52..22a823df 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -2385,7 +2385,7 @@ failed:
static int print_advertising_devices(int dd, uint8_t filter_type)
{
- unsigned char buf_array[HCI_MAX_EVENT_SIZE] = {0};
+ unsigned char buf_array[HCI_MAX_EVENT_SIZE+1] = {0};
unsigned char *buf = buf_array;
unsigned char *ptr = NULL;
struct hci_filter nf, of;
@@ -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-1] = 0;
+ buf[HCI_MAX_EVENT_SIZE] = 0;
while ((len = read(dd, buf, HCI_MAX_EVENT_SIZE)) < 0) {
if (errno == EINTR && signal_received == SIGINT) {
@@ -2452,7 +2452,7 @@ static int print_advertising_devices(int dd, uint8_t filter_type)
eir_parse_name(info->data, info->length,
name, 29);
- name_array[29] = '\0';
+ name[29] = '\0';
printf("%s %s\n", addr, name);
}
}