summaryrefslogtreecommitdiffstats
path: root/tools/toollib.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2010-12-01 12:22:49 +0000
committerZdenek Kabelac <zkabelac@redhat.com>2010-12-01 12:22:49 +0000
commit5bd1cb414b6cb91da1d138c5b58c2629a0ff72f2 (patch)
treec215a04ceaf7bad3439d119ec5bc02808930cfac /tools/toollib.c
parent062181292a8aad21b16a5386658b5c6d30a33c74 (diff)
downloadlvm2-5bd1cb414b6cb91da1d138c5b58c2629a0ff72f2.tar.gz
lvm2-5bd1cb414b6cb91da1d138c5b58c2629a0ff72f2.tar.xz
lvm2-5bd1cb414b6cb91da1d138c5b58c2629a0ff72f2.zip
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.
Diffstat (limited to 'tools/toollib.c')
-rw-r--r--tools/toollib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/toollib.c b/tools/toollib.c
index f6ba45be..9be99362 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -331,7 +331,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
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,