xorg-x11-drv-qxl/SOURCES/0007-modesetting-Validate-the-atom-for-enum-properties.patch
2021-10-08 20:17:20 +00:00

34 lines
1.1 KiB
Diff

From 78abd5221f7efd87383aa357590efff083449aa3 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Tue, 13 Jun 2017 09:29:28 -0400
Subject: [PATCH] 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>
---
src/qxl_drmmode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qxl_drmmode.c b/src/qxl_drmmode.c
index 3c288f9..ff164cd 100644
--- a/src/qxl_drmmode.c
+++ b/src/qxl_drmmode.c
@@ -622,7 +622,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++) {
--
2.13.0