diff options
author | Pekka Paalanen <ppaalanen@gmail.com> | 2012-07-31 13:21:12 +0300 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-07-31 22:27:23 -0400 |
commit | 07684193931e98d55234e80861325f4e7e587449 (patch) | |
tree | 2057413d606e3f33f2a86f4e9e45699a38d692ef /clients/simple-touch.c | |
parent | 55b7cb24e0acb77e674f886e4557519e7177e359 (diff) |
simple-touch: fix off-by-one in position checks
Fix the off by one error in checking whether we can draw the marker
without exceeding buffer dimensions.
Fixes a segfault.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Diffstat (limited to 'clients/simple-touch.c')
-rw-r--r-- | clients/simple-touch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clients/simple-touch.c b/clients/simple-touch.c index 3a1d9402..f8afbb00 100644 --- a/clients/simple-touch.c +++ b/clients/simple-touch.c @@ -118,8 +118,8 @@ touch_paint(struct touch *touch, int32_t x, int32_t y, int32_t id) else c = 0xffffffff; - if (x < 2 || touch->width - 2 < x || - y < 2 || touch->height - 2 < y) + if (x < 2 || x >= touch->width - 2 || + y < 2 || y >= touch->height - 2) return; p = (uint32_t *) touch->data + (x - 2) + (y - 2) * touch->width; |