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).
This commit is contained in:
robertmh 2008-10-29 19:22:13 +00:00
parent 7ab28c2157
commit b727944702
2 changed files with 12 additions and 2 deletions

View file

@ -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

View 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: