mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-28 14:11:29 +01:00
cros_ec: Add run-time check for input buffer overflow
This should not happen in normal operation, but the EC might have a bug, so add a run-time check just in case. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
2525e53c27
commit
698e30f7a8
@ -404,6 +404,8 @@ static int ec_command(struct udevice *dev, uint cmd, int cmd_version,
|
||||
*/
|
||||
if (din && in_buffer) {
|
||||
assert(len <= din_len);
|
||||
if (len > din_len)
|
||||
return -ENOSPC;
|
||||
memmove(din, in_buffer, len);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user