Whamcloud - gitweb
LU-6081 lfs: check that pool name is not too long 41/13241/8
authorFrank Zago <fzago@cray.com>
Wed, 3 Dec 2014 22:42:18 +0000 (16:42 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 19 Jan 2015 23:45:56 +0000 (23:45 +0000)
There was no check on the length of the pool name, so it could be
silently truncated when used.

Signed-off-by: frank zago <fzago@cray.com>
Change-Id: Ic18d28a4572ce54c39b35c3ea130ccbfdf33b34d
Reviewed-on: http://review.whamcloud.com/13241
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Henri Doreau <henri.doreau@cea.fr>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/utils/lfs.c

index 048b399..dbb27eb 100644 (file)
@@ -856,6 +856,13 @@ static int lfs_setstripe(int argc, char **argv)
                return CMD_HELP;
        }
 
                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,
        /* get the stripe size */
        if (stripe_size_arg != NULL) {
                result = llapi_parse_size(stripe_size_arg, &st_size,