multipath-tools/kpartx gpt.c
authorbmarzins@sourceware.org <bmarzins@sourceware.org>
Mon, 24 Oct 2011 13:37:18 +0000 (13:37 +0000)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 2 Nov 2011 21:30:38 +0000 (22:30 +0100)
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch:  RHEL5_FC6
Changes by: bmarzins@sourceware.org 2011-10-24 13:37:18

Modified files:
kpartx         : gpt.c

Log message:
Fix for bz #719575.  Validate size of GPT partitions.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/kpartx/gpt.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.3&r2=1.3.2.1

kpartx/gpt.c

index 047a82907396237f45c52e775c63482f5aaf3d3b..d0dec70231ce0c8684b577725d6d07deaf99d3d6 100644 (file)
@@ -358,6 +358,15 @@ is_gpt_valid(int fd, uint64_t lba,
                return 0;
        }
 
+       /* Check that sizeof_partition_entry has the correct value */
+       if (__le32_to_cpu((*gpt)->sizeof_partition_entry) != sizeof(gpt_entry)) {
+               // printf("GUID partition entry size check failed.\n");
+               free(*gpt);
+               *gpt = NULL;
+               return 0;
+       }
+
+
        if (!(*ptes = alloc_read_gpt_entries(fd, *gpt))) {
                free(*gpt);
                *gpt = NULL;