Re: [PATCH] HID: mcp2221: prevent a buffer overflow in mcp_smbus_write()

From: Dan Carpenter
Date: Tue Jun 21 2022 - 02:36:17 EST


On Mon, Jun 20, 2022 at 11:58:27AM -0700, Rishi Gupta wrote:
> Hi Harshit,
>
> Can you check the datasheet for correct buffer sizes please. Then
> accordingly we will decide next step.
>

No, we don't have access to the data sheets. This is the exact same
bug as the following patches:

381583845d19 ("HID: cp2112: prevent a buffer overflow in cp2112_xfer()")
690b2549b195 ("i2c: ismt: prevent memory corruption in ismt_access()")

The patch should fix the memory corruption but there may be other issues
with this code.

regards,
dan carpenter