Skip to content

Commit

Permalink
Sanity check for claiming an endpoint
Browse files Browse the repository at this point in the history
- Ensuring that only a valid non-control endpoint can be claimed
  • Loading branch information
RockyZeroFour committed May 29, 2024
1 parent 75e620d commit 0915bac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/device/usbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,9 @@ bool usbd_edpt_claim(uint8_t rhport, uint8_t ep_addr)
// TU_VERIFY(tud_ready());

uint8_t const epnum = tu_edpt_number(ep_addr);

TU_ASSERT( 0 < epnum && CFG_TUD_ENDPPOINT_MAX > epnum );

uint8_t const dir = tu_edpt_dir(ep_addr);
tu_edpt_state_t* ep_state = &_usbd_dev.ep_status[epnum][dir];

Expand Down

0 comments on commit 0915bac

Please sign in to comment.