The kernel copies up to sizeof(devname) bytes but doesn't null-terminate the
string if the device name exceeds the size of the supplied buffer.
device->fd = device_fd;
ioctl(device->fd, EVIOCGNAME(sizeof(devname)), devname);
device->fd = device_fd;
ioctl(device->fd, EVIOCGNAME(sizeof(devname)), devname);
+ devname[sizeof(devname) - 1] = '\0';
device->devname = strdup(devname);
if (!evdev_handle_device(device)) {
device->devname = strdup(devname);
if (!evdev_handle_device(device)) {