OSDN Git Service

input/hog-lib: Fix not truncating name
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 29 Aug 2016 09:56:02 +0000 (12:56 +0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 30 Aug 2016 08:14:11 +0000 (11:14 +0300)
Bluetooth name can be bigger than uhid can support.

profiles/input/hog-lib.c

index 0884ef7..e376c2b 100644 (file)
@@ -1018,7 +1018,7 @@ static void report_map_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
                return;
        }
 
-       strcpy((char *) ev.u.create.name, hog->name);
+       strncpy((char *) ev.u.create.name, hog->name, sizeof(ev.u.create.name));
        ev.u.create.vendor = hog->vendor;
        ev.u.create.product = hog->product;
        ev.u.create.version = hog->version;