[PATCH 02/17] mkfs: sanitise ftype parameter values.

Brian Foster bfoster at redhat.com
Thu Jun 25 14:37:54 CDT 2015


On Fri, Jun 19, 2015 at 01:01:51PM +0200, Jan Ťulák wrote:
> From: Dave Chinner <dchinner at redhat.com>
> 
> Because passing "-n ftype=2" should fail.
> 
> Signed-off-by: Dave Chinner <dchinner at redhat.com>
> Signed-off-by: Jan Ťulák <jtulak at redhat.com>
> ---

Reviewed-by: Brian Foster <bfoster at redhat.com>

>  mkfs/xfs_mkfs.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index d0de90d..1652903 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -1617,12 +1617,15 @@ _("cannot specify both crc and ftype\n"));
>  						reqval('n', nopts, N_FTYPE);
>  					if (nftype)
>  						respec('n', nopts, N_FTYPE);
> -					dirftype = atoi(value);
> +					c = atoi(value);
> +					if (c < 0 || c > 1)
> +						illegal(value, "n ftype");
>  					if (crcs_enabled) {
>  						fprintf(stderr,
>  _("cannot specify both crc and ftype\n"));
>  						usage();
>  					}
> +					dirftype = c;
>  					nftype = 1;
>  					break;
>  				default:
> -- 
> 2.1.0
> 
> _______________________________________________
> xfs mailing list
> xfs at oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs



More information about the xfs mailing list