1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-25 18:50:51 +03:00

lvrename: fix name length validation

This test for LV name restriction check name of device is below 128
chars (which is enforced by dm target).
Thus it should not count with device name.
(Though the test for PATH_MAX size should be probably also added,
but this is runtime test, since theoretically devpath might differ in cluster)
This commit is contained in:
Zdenek Kabelac 2014-03-31 11:40:52 +02:00
parent caa429da2e
commit d3e4934a15
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
Validate length of new LV name in lvrename to not exceed 127 characters.
Add explict error message when using lvdisplay -c -m.
Update man pages for pv/vg/lvdisplay.
Report error when running pvscan with free argument (i.e. PV name).

View File

@ -71,10 +71,10 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
lv_name_new = st + 1;
/* Check sanity of new name */
maxlen = NAME_LEN - strlen(vg_name) - strlen(cmd->dev_dir) - 3;
maxlen = NAME_LEN - strlen(vg_name) - 3;
if (strlen(lv_name_new) > maxlen) {
log_error("New logical volume path exceeds maximum length "
"of %" PRIsize_t "!", maxlen);
log_error("New logical volume name \"%s\" may not exceed %"
PRIsize_t " characters.", lv_name_new, maxlen);
return EINVALID_CMD_LINE;
}