OSDN Git Service

BT: fix possible out of bounds read
authorkschulz <k.schulz@samsung.com>
Wed, 11 Feb 2015 13:41:51 +0000 (14:41 +0100)
committerAndre Eisenbach <eisenbach@google.com>
Thu, 2 Apr 2015 08:46:53 +0000 (01:46 -0700)
commit12caf20c35dbae85a678ee6fc5c8aec352c16592
tree1a59dc80d211dab3a807602684150f7b7c8167ad
parent107660fcceaba6632b64fcba1864a51da9ad3a9c
BT: fix possible out of bounds read

In btm_ble_bgconn.c, function btm_update_bg_conn_list() if the last element in
"p_cb->bg_dev_list" is removed, the line:

"p_next = p_bg_dev + 1;"

will get "p_next" to point at an entry outside the bounds of the array.
There check for "p_next->in_use" may render a TRUE result depending on what
data exist in the memory pointed to by "p_next", which is unknown.
If the check passes, the sentence:

" memcpy(p_cur, p_next, sizeof(tBTM_LE_BG_CONN_DEV));"

will copy random data into the entry pointed at by "p_cur".
This can potentially corrupt the white list filling it with entries that
contain garbage and not allowing to add new valid devices to the list.

Bug: 18748601
Change-Id: I98b4be4e9f4568ea77f89146eae1e38f19fa1ee3
stack/btm/btm_ble_bgconn.c