All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/4] fs: cbfs: remove wrong header validation
@ 2018-12-22  9:55 Bin Meng
  2018-12-22  9:55 ` [U-Boot] [PATCH 2/4] fs: cbfs: Fix out of bound access during CBFS walking through Bin Meng
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Bin Meng @ 2018-12-22  9:55 UTC (permalink / raw)
  To: u-boot

From: Christian Gmeiner <christian.gmeiner@gmail.com>

cbfs_fileheader.len indicates the content size of the file in the
cbfs, and it has nothing to do with cbfs_fileheader.offset which
is the starting address of the file in the cbfs.

Remove such check in file_cbfs_next_file(). Before this change
'cbfsinit' failed with 'Bad CBFS file'. After this change all cbfs
commands are working as expected.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
[bmeng: keep the necessary header sanity check]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

 fs/cbfs/cbfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index 0dce639..e943325 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -96,8 +96,7 @@ static int file_cbfs_next_file(u8 *start, u32 size, u32 align,
 		}
 
 		swap_file_header(&header, fileHeader);
-		if (header.offset < sizeof(struct cbfs_fileheader) ||
-		    header.offset > header.len) {
+		if (header.offset < sizeof(struct cbfs_fileheader)) {
 			file_cbfs_result = CBFS_BAD_FILE;
 			return -1;
 		}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-12-31  1:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-22  9:55 [U-Boot] [PATCH 1/4] fs: cbfs: remove wrong header validation Bin Meng
2018-12-22  9:55 ` [U-Boot] [PATCH 2/4] fs: cbfs: Fix out of bound access during CBFS walking through Bin Meng
2018-12-29 13:39   ` Simon Glass
2018-12-31  1:44     ` Bin Meng
2018-12-22  9:55 ` [U-Boot] [PATCH 3/4] fs: cbfs: Make all CBFS_TYPE_xxx macros consistent Bin Meng
2018-12-29 13:39   ` Simon Glass
2018-12-31  1:45     ` Bin Meng
2018-12-22  9:55 ` [U-Boot] [PATCH 4/4] fs: cbfs: Add missing standard CBFS component types Bin Meng
2018-12-29 13:39   ` Simon Glass
2018-12-31  1:45     ` Bin Meng
2018-12-29 13:39 ` [U-Boot] [PATCH 1/4] fs: cbfs: remove wrong header validation Simon Glass
2018-12-31  1:44   ` Bin Meng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.