ACK: [PATCH] lib: fwts_args: fix arg parameter sanity range checking

ivanhu ivan.hu at canonical.com
Thu Feb 2 01:23:04 UTC 2017



On 2017年01月20日 18:54, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> An earlier commit remove the arg parameter sanity range checking
> which should be re-instated. Add the code back.
>
> Fixes: 973a296cad30 ("v2 - lib: fwts_args: handle cases to set optarg_handler for long options.")
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/lib/src/fwts_args.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c
> index 5d47547..fec656f 100644
> --- a/src/lib/src/fwts_args.c
> +++ b/src/lib/src/fwts_args.c
> @@ -212,6 +212,16 @@ int fwts_args_parse(fwts_framework *fw, const int argc, char * const argv[])
>  		}
>  	}
>
> +	/* We've collected all the args, now sanity check the values */
> +
> +	fwts_list_foreach(item, &options_list) {
> +		options_table = fwts_list_data(fwts_options_table *, item);
> +		if (options_table->optarg_check != NULL) {
> +			ret = options_table->optarg_check(fw);
> +			if (ret != FWTS_OK)
> +				break;
> +		}
> +	}
>  exit:
>  	free(short_options);
>  	free(long_options);
>

Acked-by: Ivan Hu <ivan.hu at canonical.com>



More information about the fwts-devel mailing list