Skip to contentSkip to conversation

Fix incorrect memset when clearing response structure.

PATCH New Dean Camera 1 participant 1 message Nov 21, 2020 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix incorrect memset when clearing response structure.

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(-)
emulator/btdev.c +1 -1
index f02103f0e..65b2048f3 100644
@@ -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);
 	cmd_complete(dev, BT_HCI_CMD_LE_READ_SUPPORTED_STATES, &rsp,
Signature · 1 line
2.29.2.windows.2