Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] media: cec: extron-da-hd-4k-plus: add sanity check
@ 2026-06-18 11:03 Hans Verkuil
  2026-06-18 11:16 ` Hans Verkuil
  2026-06-29 14:03 ` Laurent Pinchart
  0 siblings, 2 replies; 4+ messages in thread
From: Hans Verkuil @ 2026-06-18 11:03 UTC (permalink / raw)
  To: Linux Media Mailing List

Add check to prevent overflowing msg.msg[] in case the incoming data
is malformed.

Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
---
diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
index 3381d86096a1..3c6ce6f3d93e 100644
--- a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
+++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
@@ -657,7 +657,8 @@ static void extron_process_received(struct extron_port *port, const char *data)
 	if (!port || port->disconnected)
 		return;

-	if (len < 5 || (len - 2) % 3 || data[len - 2] != '*')
+	if (len < 5 || ((len - 2) / 3 > sizeof(msg.msg)) ||
+	    (len - 2) % 3 || data[len - 2] != '*')
 		goto malformed;

 	while (*data != '*') {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-29 14:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-18 11:03 [PATCH] media: cec: extron-da-hd-4k-plus: add sanity check Hans Verkuil
2026-06-18 11:16 ` Hans Verkuil
2026-06-29 13:57   ` Sean Young
2026-06-29 14:03 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox