Skip to content

Commit

Permalink
Bluetooth: Check 'dev_class' in mgmt_device_found()
Browse files Browse the repository at this point in the history
The mgmt_device_found event will be used to report LE devices found
during discovery procedure. Since LE advertising reports events
doesn't have class of device information, we need to check if
'dev_class' is not NULL before copying it.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Andre Guedes authored and Gustavo F. Padovan committed Sep 21, 2011
1 parent a8f13c8 commit f852359
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2324,12 +2324,14 @@ int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi,
memset(&ev, 0, sizeof(ev));

bacpy(&ev.bdaddr, bdaddr);
memcpy(ev.dev_class, dev_class, sizeof(ev.dev_class));
ev.rssi = rssi;

if (eir)
memcpy(ev.eir, eir, sizeof(ev.eir));

if (dev_class)
memcpy(ev.dev_class, dev_class, sizeof(ev.dev_class));

return mgmt_event(MGMT_EV_DEVICE_FOUND, index, &ev, sizeof(ev), NULL);
}

Expand Down

0 comments on commit f852359

Please sign in to comment.