From: Frank Zago Date: Wed, 3 Dec 2014 22:42:18 +0000 (-0600) Subject: LU-6081 lfs: check that pool name is not too long X-Git-Tag: 2.6.93~33 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F13241%2F8;p=fs%2Flustre-release.git LU-6081 lfs: check that pool name is not too long There was no check on the length of the pool name, so it could be silently truncated when used. Signed-off-by: frank zago Change-Id: Ic18d28a4572ce54c39b35c3ea130ccbfdf33b34d Reviewed-on: http://review.whamcloud.com/13241 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Henri Doreau Reviewed-by: Andreas Dilger --- diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 048b399..dbb27eb 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -856,6 +856,13 @@ static int lfs_setstripe(int argc, char **argv) return CMD_HELP; } + if (pool_name_arg && strlen(pool_name_arg) > LOV_MAXPOOLNAME) { + fprintf(stderr, + "error: %s: pool name '%s' is too long (max is %d characters)\n", + argv[0], pool_name_arg, LOV_MAXPOOLNAME); + return CMD_HELP; + } + /* get the stripe size */ if (stripe_size_arg != NULL) { result = llapi_parse_size(stripe_size_arg, &st_size,