[PATCH] xinput: set_prop: error out if a property has unexpected format

Peter Hutterer peter.hutterer at who-t.net
Tue Apr 21 04:15:36 PDT 2009


On Tue, Apr 21, 2009 at 12:17:59PM +0200, Julien Cristau wrote:
> Signed-off-by: Julien Cristau <jcristau at debian.org>
> ---
>  src/property.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/src/property.c b/src/property.c
> index c5c21c0..e019765 100644
> --- a/src/property.c
> +++ b/src/property.c
> @@ -549,12 +549,22 @@ set_prop(Display *dpy, int argc, char **argv, char *n, char *desc)
>                      return EXIT_FAILURE;
>              }
>          } else if (type == float_atom) {
> +            if (format != 32) {
> +                fprintf(stderr, "unexpected format %d for property %s\n",
> +                        format, name);
> +                return EXIT_FAILURE;
> +            }
>              *(float *)(data.l + i) = strtod(argv[2 + i], &endptr);
>              if (endptr == argv[2 + i]) {
>                  fprintf(stderr, "argument %s could not be parsed\n", argv[2 + i]);
>                  return EXIT_FAILURE;
>              }
>          } else if (type == XA_ATOM) {
> +            if (format != 32) {
> +                fprintf(stderr, "unexpected format %d for property %s\n",
> +                        format, name);
> +                return EXIT_FAILURE;
> +            }
>              data.a[i] = parse_atom(dpy, argv[2 + i]);
>          } else {
>              fprintf(stderr, "unexpected type for property %s\n", name);
> -- 
> 1.6.2.3
 
Thanks. I'm going to squash the patch below in too unless you have any
objections.

Cheers,
  Peter




More information about the xorg-devel mailing list