Skip to contentSkip to conversation

Bluetooth: btusb: off by one in rtl8723b_parse_firmware()

PATCH In review Dan Carpenter 3 participants 3 messages Apr 20, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: btusb: off by one in rtl8723b_parse_firmware()

The ">" should be ">=" so that we don't read past the end of the array.

Fixes 9d9a113e3695 ('Bluetooth: btusb: Add Realtek 8723A/8723B/8761A/8821A support')
drivers/bluetooth/btusb.c +1 -1
index 920f6fb..d21f3b4 100644
@@ -1502,7 +1502,7 @@ static int rtl8723b_parse_firmware(struct hci_dev *hdev, u16 lmp_subver,
 		return -EINVAL;
 	}
 
-	if (project_id > ARRAY_SIZE(project_id_to_lmp_subver)) {
+	if (project_id >= ARRAY_SIZE(project_id_to_lmp_subver)) {
 		BT_ERR("%s: unknown project id %d", hdev->name, project_id);
 		return -EINVAL;
 	}
#1 lore raw
Quoted 4 lines · Dan Carpenter

The ">" should be ">=" so that we don't read past the end of the array.

Fixes 9d9a113e3695 ('Bluetooth: btusb: Add Realtek 8723A/8723B/8761A/8821A support')

Oops! Your fix looks correct.

Thanks
Daniel