diff options
Diffstat (limited to 'payloads/libpayload/libcbfs/cbfs_core.c')
-rw-r--r-- | payloads/libpayload/libcbfs/cbfs_core.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/payloads/libpayload/libcbfs/cbfs_core.c b/payloads/libpayload/libcbfs/cbfs_core.c index 1945813bb5..d14cf61a67 100644 --- a/payloads/libpayload/libcbfs/cbfs_core.c +++ b/payloads/libpayload/libcbfs/cbfs_core.c @@ -173,10 +173,14 @@ struct cbfs_file *cbfs_get_file(struct cbfs_media *media, const char *name) return NULL; } -void *cbfs_get_file_content(struct cbfs_media *media, const char *name, int type) +void *cbfs_get_file_content(struct cbfs_media *media, const char *name, + int type, size_t *sz) { struct cbfs_file *file = cbfs_get_file(media, name); + if (sz) + *sz = 0; + if (file == NULL) { ERROR("Could not find file '%s'.\n", name); return NULL; @@ -188,7 +192,10 @@ void *cbfs_get_file_content(struct cbfs_media *media, const char *name, int type return NULL; } - return (void*)CBFS_SUBHEADER(file); + if (sz) + *sz = ntohl(file->len); + + return (void *)CBFS_SUBHEADER(file); } int cbfs_decompress(int algo, void *src, void *dst, int len) |