summaryrefslogtreecommitdiff
path: root/util/cbfstool/cbfs_image.c
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2016-12-14 16:08:52 +0100
committerPatrick Georgi <pgeorgi@google.com>2016-12-15 22:18:25 +0100
commita2ce710df749f06bcdfa95329491046870f3c729 (patch)
tree67816484bec550e451ff6b7b8dda0383f974239b /util/cbfstool/cbfs_image.c
parentd03391aa68f93b7d87370e9d63f3ec71a7f68dd0 (diff)
downloadcoreboot-a2ce710df749f06bcdfa95329491046870f3c729.tar.xz
util/cbfstool: Add NULL-ptr check
Change-Id: I8b5caf5423135fe683a24db6700b895a2685cb98 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Found-by: Coverity Scan #1323507 Reviewed-on: https://review.coreboot.org/17858 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'util/cbfstool/cbfs_image.c')
-rw-r--r--util/cbfstool/cbfs_image.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index e1a0e8c858..ee229b365d 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -175,7 +175,8 @@ static int cbfs_file_get_compression_info(struct cbfs_file *entry,
uint32_t *decompressed_size)
{
unsigned int compression = CBFS_COMPRESS_NONE;
- *decompressed_size = ntohl(entry->len);
+ if (decompressed_size)
+ *decompressed_size = ntohl(entry->len);
for (struct cbfs_file_attribute *attr = cbfs_file_first_attr(entry);
attr != NULL;
attr = cbfs_file_next_attr(entry, attr)) {