From: Chris Bagwell <[email protected]>

Since btn is a bit location, compute how may bytes it would require
before comparing to sizeof().

Signed-off-by: Chris Bagwell <[email protected]>
---

Since last patch, change approach to see how many bytes to
store this button # in instead of converting sizeof() to # of
bits.  This is to make it easier to switch to bits_to_bytes()
routine in xserver's include/misc.h.

I chose not to use that though because I think its kinda heavy handed
requirement to have users install X server headers just to compile
this input module.  Also, I'm not sure how to get access to server
header files anyways.  I'm sure a file called "misc.h" isn't installed
to /usr/include?  And that means configure would need modification as well.

 src/wcmUSB.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 9ff59ea..061b0af 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1054,7 +1054,7 @@ static int mod_buttons(int buttons, int btn, int state)
 {
        int mask;
 
-       if (btn >= sizeof(int))
+       if ((btn+7) >> 3 > sizeof(int))
        {
                xf86Msg(X_ERROR, "%s: Invalid button number %d. Insufficient "
                                "storage\n", __func__, btn);
-- 
1.7.4.2


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to