Connecting devices which are unknown to the user-level driver led to
crashes or hangs of the X-Server due to usage of uninitialized struct
members. This problem is avoided by making the initialization function
responsible for populating these fields return an error if no matching
entry could be found in the WacomModelDesc table rather than carrying on
with invalid data.

Signed-off-by: Julian Ganz <neither@nut.email>
---
 src/wcmUSB.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index dcb1690..e7bbceb 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -394,6 +394,7 @@ void usbListModels(void)
 static Bool usbWcmInit(InputInfoPtr pInfo, char* id, size_t id_len, float 
*version)
 {
        int i;
+       Bool found = FALSE;
        struct input_id sID;
        WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;
        WacomCommonPtr common = priv->common;
@@ -425,12 +426,16 @@ static Bool usbWcmInit(InputInfoPtr pInfo, char* id, 
size_t id_len, float *versi
                if (sID.vendor == WacomModelDesc[i].vendor_id &&
                    sID.product == WacomModelDesc [i].model_id)
                {
+                       found = TRUE;
                        common->wcmModel = WacomModelDesc [i].model;
                        common->wcmResolX = WacomModelDesc [i].xRes;
                        common->wcmResolY = WacomModelDesc [i].yRes;
                }
        }
 
+       if (!found)
+               return !Success;
+
        if (!common->wcmModel)
        {
                common->wcmModel = &usbUnknown;
-- 
2.6.4



------------------------------------------------------------------------------
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to