summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2012-10-25 15:03:50 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2012-11-07 09:59:06 +1000
commit10d9cd36b4966c8e3ea8e791152e1af166224ee8 (patch)
tree9b9454b46ec2abf3e2a70e995a95adf5abb5cb58
parent835737244f84d34b0b9c5a93560710a2275dcc63 (diff)
Sync TouchListener memory allocation with population in TouchSetupListeners()
The allocated TouchListener array may fall short by 1 if hitting the worst case situation where there's an active grab, passive grabs on each window in the sprite trace and event selection for touch in one of the windows. This may lead to memory corruptions as the array is overflown. Signed-off-by: Carlos Garnacho <carlosg@gnome.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit ced56f322ead10d1bc93fcd1f8e0ec3ae51292a3)
-rw-r--r--dix/touch.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dix/touch.c b/dix/touch.c
index e64a6262c..5f77be575 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -572,8 +572,8 @@ TouchBuildSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
return FALSE;
/* Mark which grabs/event selections we're delivering to: max one grab per
- * window plus the bottom-most event selection. */
- ti->listeners = calloc(sprite->spriteTraceGood + 1, sizeof(*ti->listeners));
+ * window plus the bottom-most event selection, plus any active grab. */
+ ti->listeners = calloc(sprite->spriteTraceGood + 2, sizeof(*ti->listeners));
if (!ti->listeners) {
sprite->spriteTraceGood = 0;
return FALSE;