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

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@sun.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Alan Coopersmith 2009-09-15 13:54:51 -07:00 committed by Peter Hutterer
parent 38a61e9a7c
commit 13decf5efe

View File

@ -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);