Merge lp:~chasedouglas/geis/prevent_device_overrun into lp:geis

Proposed by Chase Douglas on 2011-08-29
Status: Merged
Merged at revision: 161
Proposed branch: lp:~chasedouglas/geis/prevent_device_overrun
Merge into: lp:geis
Diff against target: 20 lines (+8/-2)
1 file modified
libutouch-geis/backend/xcb/geis_xcb_backend_token.c (+8/-2)
To merge this branch: bzr merge lp:~chasedouglas/geis/prevent_device_overrun
Reviewer Review Type Date Requested Status
Open Input Framework Team 2011-08-29 Pending
Review via email: mp+73268@code.launchpad.net
To post a comment you must log in.
161. By Chase Douglas on 2011-08-29

Prevent overrun of devices array in xcb backend token

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libutouch-geis/backend/xcb/geis_xcb_backend_token.c'
2--- libutouch-geis/backend/xcb/geis_xcb_backend_token.c 2011-07-25 14:02:47 +0000
3+++ libutouch-geis/backend/xcb/geis_xcb_backend_token.c 2011-08-29 17:51:04 +0000
4@@ -434,8 +434,14 @@
5 {
6 GeisInteger device_id = *(GeisInteger*)value;
7 geis_debug("attr name=\"%s\" value=%d", name, device_id);
8- t->devices[t->device_count++] = device_id;
9- status = GEIS_STATUS_SUCCESS;
10+ if (t->device_count < MAX_NUM_DEVICES) {
11+ t->devices[t->device_count++] = device_id;
12+ status = GEIS_STATUS_SUCCESS;
13+ }
14+ else {
15+ geis_warning("too many devices in xcb backend token");
16+ status = GEIS_STATUS_UNKNOWN_ERROR;
17+ }
18 }
19 else if (0 == strcmp(name, GEIS_DEVICE_ATTRIBUTE_DIRECT_TOUCH)
20 && op == GEIS_FILTER_OP_EQ)

Subscribers

People subscribed via source and target branches