mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
OHCI: Fix array out of bounds issue
If using a USB hub, a request outside the array size can occur Original line:ffb257ac17/src/portable/ohci/ohci.h (L162)
It can happen in a few places but one such example is here:ffb257ac17/src/portable/ohci/ohci.c (L460)
ie. if HUB address is 5, this would be an array index out of bounds on control endpoints as `CFG_TUH_DEVICE_MAX+1` is only 5. This fix just includes num of hubs in the reserve array size. Fixing locally fixed this issue.
This commit is contained in:
parent
ffb257ac17
commit
453ba529a6
@ -159,7 +159,7 @@ typedef struct TU_ATTR_ALIGNED(256)
|
||||
struct {
|
||||
ohci_ed_t ed;
|
||||
ohci_gtd_t gtd;
|
||||
}control[CFG_TUH_DEVICE_MAX+1];
|
||||
}control[CFG_TUH_DEVICE_MAX+CFG_TUH_HUB+1];
|
||||
|
||||
// ochi_itd_t itd[OHCI_MAX_ITD]; // itd requires alignment of 32
|
||||
ohci_ed_t ed_pool[HCD_MAX_ENDPOINT];
|
||||
|
Loading…
x
Reference in New Issue
Block a user