diff options
-rw-r--r-- | hcid/dbus-adapter.c | 8 | ||||
-rw-r--r-- | hcid/dbus.c | 2 | ||||
-rw-r--r-- | hcid/security.c | 4 |
3 files changed, 6 insertions, 8 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c index b938df9f..97330dc5 100644 --- a/hcid/dbus-adapter.c +++ b/hcid/dbus-adapter.c @@ -2399,7 +2399,7 @@ static DBusHandlerResult handle_dev_discover_devices_req(DBusConnection *conn, D evt_cmd_status rp; struct hci_request rq; struct hci_dbus_data *dbus_data = data; - uint32_t lap = 0x9e8b33; + uint8_t lap[3] = { 0x33, 0x8b, 0x9e }; int dd; if (!dbus_data->up) @@ -2421,9 +2421,7 @@ static DBusHandlerResult handle_dev_discover_devices_req(DBusConnection *conn, D return error_no_such_adapter(conn, msg); memset(&cp, 0, sizeof(cp)); - cp.lap[0] = lap & 0xff; - cp.lap[1] = (lap >> 8) & 0xff; - cp.lap[2] = (lap >> 16) & 0xff; + memcpy(&cp.lap, lap, 3); cp.length = 0x08; cp.num_rsp = 0x00; @@ -2490,7 +2488,7 @@ static DBusHandlerResult handle_dev_cancel_discovery_req(DBusConnection *conn, D /* only the discover requestor can cancel the inquiry process */ if (!dbus_data->discovery_requestor || - strcmp(dbus_data->discovery_requestor, dbus_message_get_sender(msg))) + strcmp(dbus_data->discovery_requestor, dbus_message_get_sender(msg))) return error_not_authorized(conn, msg); /* * Cleanup the discovered devices list and send the cmd diff --git a/hcid/dbus.c b/hcid/dbus.c index 0d90aaeb..59230c12 100644 --- a/hcid/dbus.c +++ b/hcid/dbus.c @@ -2034,7 +2034,7 @@ void hcid_dbus_pin_code_reply(bdaddr_t *local, void *ptr) struct hci_dbus_data *pdata; char *local_addr; - ret_pin_code_req_reply *ret = ptr + sizeof(evt_cmd_complete); + ret_pin_code_req_reply *ret = ptr + EVT_CMD_COMPLETE_SIZE; struct slist *l; char path[MAX_PATH_LENGTH]; bdaddr_t tmp; diff --git a/hcid/security.c b/hcid/security.c index 7f1ad703..d44bfea4 100644 --- a/hcid/security.c +++ b/hcid/security.c @@ -431,11 +431,11 @@ static inline void cmd_complete(int dev, bdaddr_t *sba, void *ptr) switch (evt->opcode) { case cmd_opcode_pack(OGF_LINK_CTL, OCF_PERIODIC_INQUIRY): - status = *((uint8_t *) ptr + sizeof(evt_cmd_complete)); + status = *((uint8_t *) ptr + EVT_CMD_COMPLETE_SIZE); hcid_dbus_periodic_inquiry_start(sba, status); break; case cmd_opcode_pack(OGF_LINK_CTL, OCF_EXIT_PERIODIC_INQUIRY): - status = *((uint8_t *) ptr + sizeof(evt_cmd_complete)); + status = *((uint8_t *) ptr + EVT_CMD_COMPLETE_SIZE); hcid_dbus_periodic_inquiry_exit(sba, status); break; case cmd_opcode_pack(OGF_LINK_CTL, OCF_INQUIRY_CANCEL): |