[PATCH] lib: fwts_args: only handle non-zero length short_names
Alex Hung
alex.hung at canonical.com
Wed Apr 11 03:44:07 UTC 2012
On 04/10/2012 10:17 PM, Colin King wrote:
> From: Colin Ian King<colin.king at canonical.com>
>
> Signed-off-by: Colin Ian King<colin.king at canonical.com>
> ---
> src/lib/src/fwts_args.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c
> index 90f3d70..b5ef3e0 100644
> --- a/src/lib/src/fwts_args.c
> +++ b/src/lib/src/fwts_args.c
> @@ -116,14 +116,14 @@ int fwts_args_parse(fwts_framework *fw, int argc, char * const argv[])
>
> for (i=0; i<options_table->num_options; i++, n++) {
> char *short_name = options_table->options[i].short_name;
> + size_t len;
>
> long_options[n].name = options_table->options[i].long_name;
> long_options[n].has_arg = options_table->options[i].has_arg;
> long_options[n].flag = 0;
> long_options[n].val = 0;
>
> - if (short_name != NULL) {
> - int len = strlen(short_name);
> + if (short_name&& (len = strlen(short_name))> 0) {
> if (short_options) {
> short_options = realloc(short_options,
> strlen(short_options) + len + 1);
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list