If not inputattached, the product_str is NULL and udev doesn't provide a way
to query it. Assume it as 0 instead of crashing.

https://bugzilla.redhat.com/show_bug.cgi?id=819191

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 libwacom/libwacom.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index 23bdb2f..0f44214 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -177,11 +177,17 @@ get_device_info (const char   *path,
                        g_object_unref (old_parent);
                }
 
-               g_assert (product_str);
-               if (sscanf(product_str, "%d/%x/%x/%d", &garbage, vendor_id, 
product_id, &garbage) != 4) {
-                       libwacom_error_set(error, WERROR_UNKNOWN_MODEL, "Unable 
to parse model identification");
-                       g_object_unref(parent);
-                       goto bail;
+               if (product_str) {
+                       if (sscanf(product_str, "%d/%x/%x/%d", &garbage, 
vendor_id, product_id, &garbage) != 4) {
+                               libwacom_error_set(error, WERROR_UNKNOWN_MODEL, 
"Unable to parse model identification");
+                               g_object_unref(parent);
+                               goto bail;
+                       }
+               } else {
+                       g_assert(*bus == WBUSTYPE_SERIAL);
+
+                       *vendor_id = 0;
+                       *product_id = 0;
                }
                if (parent)
                        g_object_unref (parent);
-- 
1.7.10.1


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to