From 5bd1cb414b6cb91da1d138c5b58c2629a0ff72f2 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 1 Dec 2010 12:22:49 +0000 Subject: 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. --- tools/toollib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/toollib.c') 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, -- cgit