media: cec: extron-da-hd-4k-plus: add sanity check

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

Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Reviewed-by: Sean Young <sean@mess.org>
Fixes: 056f2821b6 ("media: cec: extron-da-hd-4k-plus: add the Extron DA HD 4K Plus CEC driver")
Cc: stable@vger.kernel.org
This commit is contained in:
Hans Verkuil
2026-06-18 13:03:19 +02:00
parent fb9dda38d4
commit abac9820b2

View File

@@ -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 != '*') {