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

Julien Cristau jcristau at debian.org
Tue Apr 21 03:17:59 PDT 2009


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



More information about the xorg-devel mailing list