Fixed seg fault when filtering Linux BLE devices.
authorOssama Othman <ossama.othman@intel.com>
Fri, 7 Aug 2015 18:49:47 +0000 (11:49 -0700)
committerErich Keane <erich.keane@intel.com>
Fri, 7 Aug 2015 20:53:26 +0000 (20:53 +0000)
commitb5bff4ab94d365d2bf48eef743a1335b93cd37cd
treecb746d47999408265415bf34fe742377177f2a13
parentb8ab6b35518490f07327cdb8ab87c4a3cbce201a
Fixed seg fault when filtering Linux BLE devices.

The loop used to filter Linux BLE devices by UUID iterated through a
zero-terminated array, and used the zero terminator as the stopping
condition.  However, it neglected to dereference the iterator to check
for the zero terminator, and incorrectly checked the iterator itself.
That resulted in the loop body dereferencing and using the last
element, the zero terminator, in a strcasecmp() call, and ultimately
seg faulting.

Rather than depend on the zero-terminator, obtain the length of the
array and use it to determine the end iterator beforehand.

Change-Id: Idecee74d19ebe01a812ecf17365f39be9ae1f7fe
Signed-off-by: Ossama Othman <ossama.othman@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2142
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/connectivity/src/bt_le_adapter/linux/caleinterface.c