OSDN Git Service

BT: Rectify size passed to copy service name to secu records
authorGurpreet Ghai <gghai@codeaurora.org>
Thu, 9 Jun 2016 09:06:35 +0000 (14:36 +0530)
committerLinux Build Service Account <lnxbuild@localhost>
Wed, 24 Aug 2016 14:09:39 +0000 (08:09 -0600)
commitb5024af811fbac821d60d3ccf9dab00a337f7c0b
treefad8e002fb38350c0b7050e978d602e95a39eb21
parentb7c0ccfc45073dbbefb0bc2507efb939942bef71
BT: Rectify size passed to copy service name to secu records

Use case: Services having name length greater than max lenght
always take new slot in security records. So, after few enable
disable cycles in BLE ON scenario, the record gets completely
occupied making further connection impossible.

Steps:
1. Install a BLE App to create BLE always ON scenario.
2. Run a few cycles of Bluetooth(bredr) enable-disable.

Failure: Once security records are completely occupied, new
connections are not possible because of socket creation
failure due to unavailability of security id.

Root cause: Size passed to copy service name does not include
bit for null termination. So, for services having name size
greater than that size have their last bit truncated for null
termication. So, during next enable, the comparision with
same size always fails causing service to take new slot in
security records array.

Fix: Increased the size passed to copy service name by 1 after
considering null termination.

Change-Id: I3527df6610932f60fd85bcdd14d5b8a527c79722
CRs-Fixed: 1026359
stack/btm/btm_sec.c