]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2008-10-29 Guillem Jover <guillem.jover@nokia.com>
authorrobertmh <robertmh@localhost>
Wed, 29 Oct 2008 19:22:13 +0000 (19:22 +0000)
committerrobertmh <robertmh@localhost>
Wed, 29 Oct 2008 19:22:13 +0000 (19:22 +0000)
        * disk/lvm.c (grub_lvm_scan_device): Fix possible NULL value handling
        (add a missing NULL check, and correct them by moving the pointer
        operations after the actual check).

ChangeLog
disk/lvm.c

index 02a5bbc04b8b16beb0505ef5f79af1a336562312..98aefe4345ecb13d784d27e85ff31401991dfb81 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-29  Guillem Jover <guillem.jover@nokia.com>
+
+       * disk/lvm.c (grub_lvm_scan_device): Fix possible NULL value handling
+       (add a missing NULL check, and correct them by moving the pointer
+       operations after the actual check).
+
 2008-10-29  Robert Millan  <rmh@aybabtu.com>
 
        * util/i386/pc/grub-install.in: Handle empty string as output from
index a28d339a54db3f0ae9b69052951f9de93a6b9d7a..0b35aa9ad981989db2e829344de55b0342c0da88 100644 (file)
@@ -384,9 +384,10 @@ grub_lvm_scan_device (const char *name)
              grub_memcpy (pv->name, p, s);
              pv->name[s] = '\0';
              
-             p = grub_strstr (p, "id = \"") + sizeof("id = \"") - 1;
+             p = grub_strstr (p, "id = \"");
              if (p == NULL)
                goto pvs_fail;
+             p += sizeof("id = \"") - 1;
              
              grub_memcpy (pv->id, p, GRUB_LVM_ID_STRLEN);
              pv->id[GRUB_LVM_ID_STRLEN] = '\0';
@@ -398,7 +399,10 @@ grub_lvm_scan_device (const char *name)
              pv->next = vg->pvs;
              vg->pvs = pv;
              
-             p = grub_strchr (p, '}') + 1;
+             p = grub_strchr (p, '}');
+             if (p == NULL)
+               goto pvs_fail;
+             p++;
              
              continue;
            pvs_fail: