summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2017-06-13 09:32:44 -0400
committerMichel Dänzer <michel.daenzer@amd.com>2017-06-15 12:22:30 +0900
commitef95e3a3cc9189c8906fe5b4d70bfa9f1055d7ce (patch)
tree6c8dd308452721a61ceaf35514205f9acfae2e6f
parentd80d01a73c2eaba2e3649b7bc0a3541b3ff782f6 (diff)
modesetting: Validate the atom for enum properties
The client could have said anything here, and if what they said doesn't actually name an atom NameForAtom() will return NULL, and strcmp() will be unhappy about that. [copied from xserver d4995a3936ae283b9080fdaa0905daa669ebacfc] Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
-rw-r--r--src/drmmode_display.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index d0ecfa85..9deaa575 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1685,7 +1685,8 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,
if (value->type != XA_ATOM || value->format != 32 || value->size != 1)
return FALSE;
memcpy(&atom, value->data, 4);
- name = NameForAtom(atom);
+ if (!(name = NameForAtom(atom)))
+ return FALSE;
/* search for matching name string, then set its value down */
for (j = 0; j < p->mode_prop->count_enums; j++) {