Skip to content

Commit

Permalink
drivers/usbdev/pl2303.c: Don't let maximum number of bytes in request…
Browse files Browse the repository at this point in the history
… exceed CONFIG_PL2303_BULKIN_REQLEN

The request length may not exceed CONFIG_PL2303_BULKIN_REQLEN, otherwise buffer overflow will occur

Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Oct 2, 2024
1 parent 31eb778 commit 1a4bba5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usbdev/pl2303.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,8 @@ static int usbclass_sndpacket(FAR struct pl2303_dev_s *priv)

/* Get the maximum number of bytes that will fit into one bulk IN request */

reqlen = MAX(CONFIG_PL2303_BULKIN_REQLEN, ep->maxpacket);
reqlen = ep->maxpacket > CONFIG_PL2303_BULKIN_REQLEN ?
CONFIG_PL2303_BULKIN_REQLEN : ep->maxpacket;

while (!sq_empty(&priv->reqlist))
{
Expand Down

0 comments on commit 1a4bba5

Please sign in to comment.