advertising: only parse adv from adv interfaces 03/204903/1
authorMatt Schulte <schultetwin1@gmail.com>
Wed, 7 Feb 2018 07:48:56 +0000 (23:48 -0800)
committerAmit Purwar <amit.purwar@samsung.com>
Mon, 15 Apr 2019 03:27:30 +0000 (08:57 +0530)
commit51916a2dc1e3f9eefa5b4d14839ea9c08fdb1f75
tree8f7a6df8a5d005f93bd78a09c085811e2d848b3b
parenta52c80d2450226e1f63589f6b6f2c5451b0b55f8
advertising: only parse adv from adv interfaces

client_proxy_added is called for every interface on an object passed in
to the dbus RegisterAdvertisement method. This can cause a NULL
dereference to occur and a failure status in the reply on dbus
RegisterAdvertisement method calls. The fix is to return early from
client_proxy_added if the proxy interface is not
org.bluez.LEAdvertisement1. If this early return is not there, two
different error paths could occur.

1) client_proxy_added is first called with the
org.bluez.LEAdvertisement1 interface and then with another interface.
The second call will fail the parse_advertisement call and possibly
cause a NULL dereference on the dbus_message_unref if
add_client_complete has already occurred.

2) client_proxy_added is first called with an unknown interface and then
org.bluez.LEAdvertisement1. The first call will cause
parse_advertisement to fail and a failure to be replied to the client
calling RegisterAdvertisement. The advertisement may be successfully
registered on the second client_proxy_added call but a NULL dereference
will occur on the call to dbus_message_new_method_return in
add_client_complete.

Change-Id: I5fa0dbaad9568d0ebdd1c358246f10b20cbe2bcc
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
src/advertising.c