projects
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2525e53
)
cros_ec: Add run-time check for input buffer overflow
author
Simon Glass
<sjg@chromium.org>
Sat, 16 Jan 2021 21:52:24 +0000
(14:52 -0700)
committer
Simon Glass
<sjg@chromium.org>
Sat, 30 Jan 2021 21:25:41 +0000
(14:25 -0700)
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>
drivers/misc/cros_ec.c
patch
|
blob
|
history
diff --git
a/drivers/misc/cros_ec.c
b/drivers/misc/cros_ec.c
index ce5fa5bee3546990417ecdbe778b59da6f2c82a3..e51ac874098433c3507efcff49cb8477e2fdcfee 100644
(file)
--- a/
drivers/misc/cros_ec.c
+++ b/
drivers/misc/cros_ec.c
@@
-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);
}
}