mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 11:03:07 -04:00
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:
@@ -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 != '*') {
|
||||
|
||||
Reference in New Issue
Block a user