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 3, 2024
1 parent 1744058 commit 9070f68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usbdev/pl2303.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ 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 = MIN(CONFIG_PL2303_BULKIN_REQLEN, ep->maxpacket);

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

0 comments on commit 9070f68

Please sign in to comment.