summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2016-12-02 09:24:50 -0800
committerFurquan Shaikh <furquan@google.com>2016-12-04 03:03:37 +0100
commit1d56eef728a9d9266b2dde9174520900ee87f9f2 (patch)
tree6880004d1903787f8a601b9a4d891ec94b6d3da7
parent2ed14f61d1a2976d0ebce59fcc67bd61fce4100d (diff)
downloadcoreboot-1d56eef728a9d9266b2dde9174520900ee87f9f2.tar.xz
cbfstool: Fix off-by-one error in checking hash_type
Change-Id: Iaf208705d0cd450288af721d53053b2d3407a336 Found-by: Coverity Scan #1325836 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/17698 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--util/cbfstool/cbfs_image.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index 6dc47c73dc..e1a0e8c858 100644
--- a/util/cbfstool/cbfs_image.c
+++ b/util/cbfstool/cbfs_image.c
@@ -1399,7 +1399,7 @@ int cbfs_print_entry_info(struct cbfs_image *image, struct cbfs_file *entry,
struct cbfs_file_attr_hash *hash = NULL;
while ((hash = cbfs_file_get_next_hash(entry, hash)) != NULL) {
unsigned int hash_type = ntohl(hash->hash_type);
- if (hash_type > CBFS_NUM_SUPPORTED_HASHES) {
+ if (hash_type >= CBFS_NUM_SUPPORTED_HASHES) {
fprintf(fp, "invalid hash type %d\n", hash_type);
break;
}