1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cmdline: fix missing NULL at end of array of args

lvm_run needs to place NULL as the last element into argv[].
Otherwise we get:

Conditional jump or move depends on uninitialised value(s)
 _command_required_pos_matches (lvmcmdline.c:1443)
 _find_command (lvmcmdline.c:1610)
 lvm_run_command (lvmcmdline.c:2770)
 lvm2_run (lvmcmdlib.c:91)
This commit is contained in:
Zdenek Kabelac 2017-06-26 20:03:05 +02:00
parent 4e4067dd94
commit 52f4042f1a
3 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
Add missing NULL to argv array when spliting cmdline arguments.
Add display_percent helper function for printing percent values.
Lvconvert --repair handles failing raid legs (present but marked 'D'ead).
Do not lvdisplay --maps unset settings of cache pool.

View File

@ -51,6 +51,9 @@ static int lvm_split(char *str, int *argc, char **argv, int max)
break;
}
if (*argc < max)
argv[*argc] = NULL;
return *argc;
}

View File

@ -3045,6 +3045,9 @@ int lvm_split(char *str, int *argc, char **argv, int max)
break;
}
if (*argc < max)
argv[*argc] = NULL;
return *argc;
}