drivers/usbdev/pl2303.c: Don't let maximum number of bytes in request 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 <jukkax@ssrc.tii.ae>
This commit is contained in:
Jukka Laitinen 2024-10-02 12:56:38 +03:00 committed by Xiang Xiao
parent 18526d78eb
commit 5d4d2cbbc8

View file

@ -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))
{