mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-29 06:31:28 +01:00
cbfs: Check offset range when reading a file
Add a check that the offset is within the allowed range. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 331155)
This commit is contained in:
parent
15dd815c75
commit
99eaf1fcaa
@ -167,6 +167,8 @@ static int file_cbfs_next_file(struct cbfs_priv *priv, void *start, int size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
swap_file_header(&header, file_header);
|
swap_file_header(&header, file_header);
|
||||||
|
if (header.offset >= size)
|
||||||
|
return log_msg_ret("range", -E2BIG);
|
||||||
ret = fill_node(node, start, &header);
|
ret = fill_node(node, start, &header);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
priv->result = CBFS_BAD_FILE;
|
priv->result = CBFS_BAD_FILE;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user