[PATCH] option-parser: Don't read off the end of string options without an '='

Bill Spitzak spitzak at gmail.com
Fri Aug 8 12:55:35 PDT 2014


I posted fixes for this as well. Never heard anything.

Will post them again to see.

On 06/19/2014 08:22 PM, Robert Ancell wrote:
> On my system:
> $ weston --shell
> would use the first environment variable as the argument to --shell
> and
> $ weston --shell foo.so
> Would use foo.so as the argument and then parse foo.so as a new option.
> ---
>   shared/option-parser.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/shared/option-parser.c b/shared/option-parser.c
> index c00349a..bddaccb 100644
> --- a/shared/option-parser.c
> +++ b/shared/option-parser.c
> @@ -66,7 +66,7 @@ parse_options(const struct weston_option *options,
>   			    argv[i][1] == '-' &&
>   			    strncmp(options[k].name, &argv[i][2], len) == 0 &&
>   			    (argv[i][len + 2] == '=' || argv[i][len + 2] == '\0')) {
> -				handle_option(&options[k], &argv[i][len + 3]);
> +				handle_option(&options[k], argv[i][len + 2] == '=' ? &argv[i][len + 3] : &argv[i][len + 2]);
>   				break;
>   			} else if (options[k].short_name &&
>   				   argv[i][0] == '-' &&
>


More information about the wayland-devel mailing list