projects
/
platform
/
kernel
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
15dd815
)
cbfs: Check offset range when reading a file
author
Simon Glass
<sjg@chromium.org>
Fri, 14 May 2021 01:39:27 +0000
(19:39 -0600)
committer
Tom Rini
<trini@konsulko.com>
Thu, 15 Jul 2021 22:42:05 +0000
(18:42 -0400)
Add a check that the offset is within the allowed range.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Coverity (CID: 331155)
fs/cbfs/cbfs.c
patch
|
blob
|
history
diff --git
a/fs/cbfs/cbfs.c
b/fs/cbfs/cbfs.c
index 415ea28b871d36f95cecf7ee1b3ba46cbb36a39e..3e905c74e58a6404fd9bfb5c518c838604e60764 100644
(file)
--- a/
fs/cbfs/cbfs.c
+++ b/
fs/cbfs/cbfs.c
@@
-167,6
+167,8
@@
static int file_cbfs_next_file(struct cbfs_priv *priv, void *start, int size,
}
swap_file_header(&header, file_header);
+ if (header.offset >= size)
+ return log_msg_ret("range", -E2BIG);
ret = fill_node(node, start, &header);
if (ret) {
priv->result = CBFS_BAD_FILE;