diff options
author | wu zheng <wu.zheng@intel.com> | 2015-01-15 17:42:17 +0800 |
---|---|---|
committer | wu zheng <wu.zheng@intel.com> | 2015-01-15 17:42:17 +0800 |
commit | ccb69ca94573c9863fe6324d77dae73ef7c01393 (patch) | |
tree | 9ae0e9177310d6e6cd92ca0725c8c4662f675c18 | |
parent | 054330269e2959ba6cf645ab290a554e2364d2e2 (diff) | |
download | bluez-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 the Security Static Code Analysis - set the lengthtizen_3.0_ivi_releasesubmit/tizen/20150115.103005submit/tizen/20150115.102847submit/accepted/tizen_common/20150115.102714submit/accepted/tizen_common/20150115.102428submit/accepted/tizen_common/20150115.102032submit/accepted/tizen_common/20150115.102016accepted/tizen/wearable/20150116.010409accepted/tizen/tv/20150116.010710accepted/tizen/mobile/20150116.011331accepted/tizen/ivi/20150116.003606accepted/tizen/common/20150115.110041tizen_3.0_ivitizen_3.0.2015.q1_commontizen_3.0.2014.q4_common
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.c | 6 |
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); } } |