[U-Boot] [PATCH] Bug in cbfs

Yaroslav K. yar444 at gmail.com
Fri Jul 22 12:21:21 CEST 2016


cbfs: Fix incorrect CBFS file header size being used

This fixes incorrect filenames in cbfsls output.

Signed-off-by: Yaroslav K. <yar444 at gmail.com>
---
 fs/cbfs/cbfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index 95a48a4..bfe8e2c 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -97,7 +97,7 @@ static int file_cbfs_next_file(u8 *start, u32 size, u32 align,
                }

                swap_file_header(&header, fileHeader);
-               if (header.offset < sizeof(const struct cbfs_cachenode *) ||
+               if (header.offset < sizeof(struct cbfs_fileheader) ||
                                header.offset > header.len) {
                        file_cbfs_result = CBFS_BAD_FILE;
                        return -1;
@@ -106,9 +106,9 @@ static int file_cbfs_next_file(u8 *start, u32
size, u32 align,
                newNode->type = header.type;
                newNode->data = start + header.offset;
                newNode->data_length = header.len;
-               name_len = header.offset - sizeof(struct cbfs_cachenode *);
+               name_len = header.offset - sizeof(struct cbfs_fileheader);
                newNode->name = (char *)fileHeader +
-                               sizeof(struct cbfs_cachenode *);
+                               sizeof(struct cbfs_fileheader);
                newNode->name_length = name_len;
                newNode->checksum = header.checksum;

-- 
1.9.1


More information about the U-Boot mailing list