OSDN Git Service

Rectify size passed to copy service name to security records
authorGurpreet Ghai <gghai@codeaurora.org>
Thu, 9 Jun 2016 09:06:35 +0000 (14:36 +0530)
committerAndre Eisenbach <eisenbach@google.com>
Fri, 14 Oct 2016 18:00:49 +0000 (18:00 +0000)
commit5f35daacde0b7baf0ddc7628ae73964e6d5486bb
tree6b3646bd7cbd5e4637045b6e58741ab5cdcbceb5
parentdd5ed02cf206ce724f3405b85aeac482cd2ece6d
Rectify size passed to copy service name to security records

Use case: Services having name length greater than max length
always take new slot in security records. 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
termination.
During next enable, the comparison 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
stack/btm/btm_sec.c