Skip to contentSkip to conversation

LVM2/tools toollib.c

PATCH [email protected] 1 participant 1 message Dec 1, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2010-12-01 12:22:49

Modified files:
tools : toollib.c

Log message:
Test lv_name is not NULL

Patch adds extra check for lv_name not being NULL. Test avoids unneeded strlen call for this case. Otherwise there is no functional change as test would fail on size_t comparation even for NULL lv_name (thus there is no risk of NULL dereference when taking 'true' if branch.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.215&r2=1.216

tools/toollib.c +1 -1
@@ -331,7 +331,7 @@
 				tags_arg = NULL;
 				dm_list_init(&lvnames);
 				break;
-			} else if (!strncmp(vg_name, vgname, strlen(vgname)) &&
+			} else if (!strncmp(vg_name, vgname, strlen(vgname)) && lv_name &&
 				   strlen(vgname) == (size_t) (lv_name - vg_name)) {
 				if (!str_list_add(cmd->mem, &lvnames,
 						  dm_pool_strdup(cmd->mem,