From: robertmh Date: Wed, 29 Oct 2008 19:22:13 +0000 (+0000) Subject: 2008-10-29 Guillem Jover X-Git-Tag: 1.98~1230 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b7279447026533ec73e96b33712462661d303a68;p=thirdparty%2Fgrub.git 2008-10-29 Guillem Jover * 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). --- diff --git a/ChangeLog b/ChangeLog index 02a5bbc04..98aefe434 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-10-29 Guillem Jover + + * 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 * util/i386/pc/grub-install.in: Handle empty string as output from diff --git a/disk/lvm.c b/disk/lvm.c index a28d339a5..0b35aa9ad 100644 --- a/disk/lvm.c +++ b/disk/lvm.c @@ -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: