Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=780834
Signed-off-by: Karel Zak <kzak@redhat.com>
if (!gpt_check_signature(header))
goto invalid;
+ /* make sure header size is between 92 and sector size bytes */
+ hsz = le32_to_cpu(header->size);
+ if (hsz < GPT_HEADER_MINSZ || hsz > cxt->sector_size)
+ goto invalid;
+
if (!gpt_check_header_crc(header, NULL))
goto invalid;
if (le64_to_cpu(header->my_lba) != lba)
goto invalid;
- /* make sure header size is between 92 and sector size bytes */
- hsz = le32_to_cpu(header->size);
- if (hsz < GPT_HEADER_MINSZ || hsz > cxt->sector_size)
- goto invalid;
if (_ents)
*_ents = ents;