[PATCH xf86-video-amdgpu] modesetting: Validate the atom for enum properties

Adam Jackson ajax at redhat.com
Tue Jun 13 13:36:21 UTC 2017


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 at redhat.com>
---
 src/drmmode_display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index f4bea0c..0d90041 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1663,7 +1663,8 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,
 			    || 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



More information about the xorg-driver-ati mailing list