diff mbox series

Fix incorrect memset when clearing response structure.

Message ID b76b25cf-e7d7-1da8-2fef-36a813ec0493@fourwalledcubicle.com (mailing list archive)
State New, archived
Headers show
Series Fix incorrect memset when clearing response structure. | expand

Commit Message

Dean Camera Nov. 21, 2020, 7:50 a.m. UTC
The cmd_le_read_supported_states handler incorrectly clears out
the response structure before filling it with what is effectively
a sizeof(int), rather than size of the actual structure.
---
  emulator/btdev.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

  	cmd_complete(dev, BT_HCI_CMD_LE_READ_SUPPORTED_STATES, &rsp,
diff mbox series

Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index f02103f0e..65b2048f3 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -3331,7 +3331,7 @@  static int cmd_le_read_supported_states(struct 
btdev *dev, const void *data,
  {
  	struct bt_hci_rsp_le_read_supported_states rsp;

-	memset(&rsp, 0, sizeof(0));
+	memset(&rsp, 0, sizeof(rsp));
  	rsp.status = BT_HCI_ERR_SUCCESS;
  	memcpy(rsp.states, dev->le_states, 8);