From 9070f6839e66d115d2c26f710f6905b1fb7ef4e4 Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Wed, 2 Oct 2024 12:56:38 +0300 Subject: [PATCH] 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 --- 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 566a3f1e2c0af..a36d39d053642 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)) {