[1888] 2008-10-29 Guillem Jover <[email protected]>

Robert Millan <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 1888
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1888
Author:   robertmh
Date:     2008-10-29 19:22:13 +0000 (Wed, 29 Oct 2008)

Log Message:
-----------
2008-10-29  Guillem Jover <[email protected]>

        * 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).

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/disk/lvm.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2008-10-29 19:14:12 UTC (rev 1887)
+++ trunk/grub2/ChangeLog	2008-10-29 19:22:13 UTC (rev 1888)
@@ -1,3 +1,9 @@
+2008-10-29  Guillem Jover <[email protected]>
+
+	* 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  <[email protected]>
 
 	* util/i386/pc/grub-install.in: Handle empty string as output from

Modified: trunk/grub2/disk/lvm.c
===================================================================
--- trunk/grub2/disk/lvm.c	2008-10-29 19:14:12 UTC (rev 1887)
+++ trunk/grub2/disk/lvm.c	2008-10-29 19:22:13 UTC (rev 1888)
@@ -384,9 +384,10 @@
 	      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 @@
 	      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:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.