summaryrefslogtreecommitdiff
path: root/tools/command.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2018-02-28 16:57:53 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2018-02-28 21:08:40 +0100
commit749372caf3e977f2e3f69848e8535fea397695e6 (patch)
treefdf1d29c560d066db18edcae883cc21248ce3c0e /tools/command.c
parentbc1adc32cbd593dd1839526da82521b429b13141 (diff)
downloadlvm2-749372caf3e977f2e3f69848e8535fea397695e6.tar.gz
command: use bigger buffer
Instead of use 'silently' shortened passed string - always make sure we take either a full copy or return error.
Diffstat (limited to 'tools/command.c')
-rw-r--r--tools/command.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/command.c b/tools/command.c
index 5a5f351e4..f97447462 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -334,13 +334,15 @@ static char *_split_line(char *buf, int *argc, char **argv, char sep)
static int _val_str_to_num(char *str)
{
- char name[32];
+ char name[MAX_LINE_ARGC];
char *new;
int i;
/* compare the name before any suffix like _new or _<lvtype> */
- dm_strncpy(name, str, sizeof(name));
+ if (!dm_strncpy(name, str, sizeof(name)))
+ return 0; /* Buffer is too short */
+
if ((new = strchr(name, '_')))
*new = '\0';