From 91f5ebb376a1600a77261f1149cdd1d74950dd77 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 17 Apr 2013 16:45:51 +0200 Subject: [PATCH] Bug fix: GPT header CRC was computed from all 512 bytes rather than from 92. --- libisofs/system_area.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libisofs/system_area.c b/libisofs/system_area.c index 955a907..47fd78d 100644 --- a/libisofs/system_area.c +++ b/libisofs/system_area.c @@ -1309,7 +1309,7 @@ int iso_write_gpt_header_block(Ecma119Image *t, uint32_t img_blocks, } /* CRC-32 of this header while head_crc is 0 */ - crc = iso_crc32_gpt((unsigned char *) buf, 512, 0); + crc = iso_crc32_gpt((unsigned char *) buf, 92, 0); wpt = ((char *) buf) + 16; iso_lsb_to_buf(&wpt, crc, 4, 0); @@ -2137,7 +2137,7 @@ tampered_head:; /* Compute new header CRC */ memset(new_head + 16, 0, 4); - crc = iso_crc32_gpt((unsigned char *) new_head, 512, 0); + crc = iso_crc32_gpt((unsigned char *) new_head, 92, 0); iso_lsb(new_head + 16, crc, 4); /* Copy GPT entries */