
Hello.
Current implementation of cbfs prints incorrect file names. In the file fs/cbfs/cbfs.c there are lines
swap_file_header(&header, fileHeader); if (header.offset < sizeof(const struct cbfs_cachenode *) || header.offset > header.len) { file_cbfs_result = CBFS_BAD_FILE; return -1; } newNode->next = NULL; newNode->type = header.type; newNode->data = start + header.offset; newNode->data_length = header.len; name_len = header.offset - sizeof(struct cbfs_cachenode *); newNode->name = (char *)fileHeader + sizeof(struct cbfs_cachenode *); newNode->name_length = name_len; newNode->checksum = header.checksum;
Shouldn't sizeof(const struct cbfs_cachenode *) and sizeof(struct cbfs_cachenode *) be replaced with sizeof(struct cbfs_fileheader)?
-- Yaroslav

+Bin
Hi,
It's a good idea to cc people who have touched the code.
I believe the implementation is out of date, so may well be incorrect. Please send a patch if you like.
Regards, Simon
On 26 June 2016 at 22:35, Yaroslav K. yar444@gmail.com wrote:
Hello.
Current implementation of cbfs prints incorrect file names. In the file fs/cbfs/cbfs.c there are lines
swap_file_header(&header, fileHeader); if (header.offset < sizeof(const struct cbfs_cachenode *) || header.offset > header.len) { file_cbfs_result = CBFS_BAD_FILE; return -1; } newNode->next = NULL; newNode->type = header.type; newNode->data = start + header.offset; newNode->data_length = header.len; name_len = header.offset - sizeof(struct cbfs_cachenode *); newNode->name = (char *)fileHeader + sizeof(struct cbfs_cachenode *); newNode->name_length = name_len; newNode->checksum = header.checksum;
Shouldn't sizeof(const struct cbfs_cachenode *) and sizeof(struct cbfs_cachenode *) be replaced with sizeof(struct cbfs_fileheader)?
-- Yaroslav _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
participants (2)
-
Simon Glass
-
Yaroslav K.