[coreboot-gerrit] New patch to review for coreboot: cbfstool: Fix off-by-one error in checking hash_type

Furquan Shaikh (furquan@google.com) gerrit at coreboot.org
Fri Dec 2 18:40:04 CET 2016


Furquan Shaikh (furquan at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17698

-gerrit

commit 2c80f80b985a465f80023bd5f14a8e206ef6610c
Author: Furquan Shaikh <furquan at chromium.org>
Date:   Fri Dec 2 09:24:50 2016 -0800

    cbfstool: Fix off-by-one error in checking hash_type
    
    Change-Id: Iaf208705d0cd450288af721d53053b2d3407a336
    Found-by: Coverity Scan #1325836
    Signed-off-by: Furquan Shaikh <furquan at chromium.org>
---
 util/cbfstool/cbfs_image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c
index 6dc47c7..e1a0e8c 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;
 		}



More information about the coreboot-gerrit mailing list