[PATCH] test_convert_XIRawEvent: Don't write more data than the struct holds

Alan Coopersmith alan.coopersmith at sun.com
Tue Sep 15 13:54:51 PDT 2009


sizeof(in.valuators.mask) * 8 == 40, but the valuators arrays only
holds 36 entries, so the test was smashing the stack when 36 < i < 40
(leading to core dumps on Solaris x86, since the return address was
 overwritten with an invalid pointer).

Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
---
 test/xi2/protocol-eventconvert.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index f723f74..65ddec5 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -247,7 +247,7 @@ static void test_convert_XIRawEvent(void)
         XIClearMask(in.valuators.mask, i);
     }
 
-    for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
+    for (i = 0; i < MAX_VALUATORS; i++)
     {
         XISetMask(in.valuators.mask, i);
 
-- 
1.5.6.5



More information about the xorg-devel mailing list