From 6ec0b44ae82638b1a47b8538496936b0f53b4e49 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Wed, 3 Dec 2014 16:42:18 -0600 Subject: [PATCH] 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 --- lustre/utils/lfs.c | 7 +++++++ 1 file changed, 7 insertions(+) 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, -- 1.8.3.1