You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/10/03 00:55:21 UTC
(nuttx) 03/04: drivers/usbdev/pl2303.c: Don't let maximum number of bytes in request exceed CONFIG_PL2303_BULKIN_REQLEN
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 5d4d2cbbc8ad19d7f06843de6c19003cf162d064
Author: Jukka Laitinen <ju...@ssrc.tii.ae>
AuthorDate: Wed Oct 2 12:56:38 2024 +0300
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 <ju...@ssrc.tii.ae>
---
drivers/usbdev/pl2303.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usbdev/pl2303.c b/drivers/usbdev/pl2303.c
index 566a3f1e2c..a36d39d053 100644
--- a/drivers/usbdev/pl2303.c
+++ b/drivers/usbdev/pl2303.c
@@ -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))
{